Re: [gcj] question about alien rhyme
Hey Lasse, you are getting it wrong. Its about different ACCENT-SUFFIXES. If you pair CODEJAM and NODEJAM, then the ACCCENT-SUFFIX is "ODEJAM", with the ACCENT on O. If you then pair MODEJAM and JAM, then the ACCCENT-SUFFIX is "JAM", with the ACCENT on J. So the two pairs WITH THEIR accents are: 1st pair2nd pair v v CODEJAMMODEJAM NODEJAMJAM ^ ^ ODEJAM and JAM are NOT THE SAME ACCENT-SUFFIXES, so they all the pairs are valid. CODEJAM and NODEJAM will rhime "ODEJAM", MODEJAM and JAM will rhime on "JAM". Thats 2 different ACCENT-SUFFIXES The ACCENT-SUFFIXES of different pairs must be different! But that does not mean that an accent-suffix can not be part of a LONGER accent-suffix. Am Sonntag, 28. April 2019 01:36:59 UTC+2 schrieb Lasse: > Hi, thank you for the example. In this case, I think we should make a pair > with "ODEJAM" and only this one. When the other word is matched to "JAM" with > "JAM", then the rule "and with none of the words in other pairs" is invalid. > > On Friday, April 26, 2019 at 12:30:07 PM UTC+2, DahliaSR wrote: > > Hi Lasse, > > > > > > another example to make this clear: > > > > > > Let the given words be: > > > > > > CODEJAM > > NODEJAM > > MODEJAM > > JAM > > > > > > The longest common suffix to of at least 2 words currently is "ODEJAM". > > So if you choose to put the accent on the "O" of that suffix, then you can > > pair 2 words with that suffix: > > - either CODEJAM <==> NODEJAM > > - or CODEJAM <==> MODEJAM > > - or MODEJAM <==> NODEJAM > > > > > > BUT you can ONLY pair EXACTLY TWO of them. > > Lets choose to pair CODEJAM <==> NODEJAM. > > If you now remove all the words ending on "ODEJAM" only JAM will be left in > > the list of words and can not be paired. > > > > > > But MODEJAM and JAM are pairable with the accent suffix "JAM", so MUST > > NEVER remove UNPAIRED words, just because they share > > a suffix with a pair you already build, because there is a chance, that one > > of the unpaired words shares a SHORTER suffix with another > > unpaired word. > > > > > > Am Do., 25. Apr. 2019 um 13:30 Uhr schrieb Lasse : > > On Wednesday, April 24, 2019 at 7:28:41 PM UTC+2, Xiongqi ZHANG wrote: > > > > > why would you ignore “scent”? even though “scent” > > > > > also has “cent” as a suffix, it can still be used to match other words > > > with different suffix, e.g “went” with rhyme “ent”. > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, Apr 24, 2019 at 8:12 AM Lasse wrote: > > > > > Hi /dev/joe, > > > > > > > > > > > > > > > > > > > > thank you for the reply. I think our understanding is the same. With your > > > example, I first match rhyme "cent", which is shared by "cent" and > > > "recent", then "scent" must be ignored in the other matches, right? > > > > > > > > > > > > > > > > > > > > I did so and my submission is wrong, but when I retained "scent" and only > > > ignored "cent" and "recent", my code works with small dataset. > > > > > > > > > > > > > > > > > > > > Lasse > > > > > > > > > > > > > > > > > > > > On Tuesday, April 23, 2019 at 10:59:35 PM UTC+2, /dev/joe wrote: > > > > > > > > > > > The problem is about matching pairs of rhymes. Apparently we know that > > > > the poems in this alien language only ever use each rhyming-ending > > > > twice. Or maybe it's that we want to see how complex the rhyme scheme > > > > could be, in terms of different rhyming endings. Since rhymes are > > > > determined based on the location of an accent in the word, and we don't > > > > know where the accents go, you are placing the accents anywhere and > > > > trying to determine the maximum number of rhymes possible as a way of > > > > helping to decide whether these words are from a poem. Here's the > > > > relevant text from the problem: > > > > > > > > > > > > > > > > > > > > > > You believe that you can discard zero or more of these words, assign > > > > accented letters to the remaining words, and then arrange those words > > > > into pairs such that each word rhymes only with the other word in its > > > > pair, and with none of the words in other pairs. > > > > > > > > > > > > > > > > > > > > > > You want to know the largest number of words that can be arranged into > > > > pairs in this way. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Example: Suppose you get the words bent, cent, dent, gent, lent, rent, > > > > recent, sent, scent, tent, and went. > > > > > > > > > > > > > > > > > > > > > > You can make two words rhyme with ending t, two with nt, two with ent, > > > > and two with cent. You will have three leftover words, but no more > > > > common endings which are not already used, so you can't make another > > > > pair even though the words have a common ending. > > > > > > > > > > > > > > > > > > > > > > > > > > > >
Re: [gcj] question about alien rhyme
Hi Lasse, For example, the words PROL and TARPOL rhyme if the accented letter in both is the O or the L, but they do not rhyme if the accented letters are the Rs, or the R in PROL and the P in TARPOL, or the O in PROL and the L in TARPOL. Please read this example again and try to think again. Basically the problem asked you to group the words into pairs, such that among all the pairs, each pair has a unique suffix and both words in that pair actually has that suffix. Words from different pairs must have different suffix, so they won't ryhme. > Hi, thank you for the example. In this case, I think we should make a pair > with "ODEJAM" and only this one. When the other word is matched to "JAM" with > "JAM", then the rule "and with none of the words in other pairs" is invalid. > > On Friday, April 26, 2019 at 12:30:07 PM UTC+2, DahliaSR wrote: > > Hi Lasse, > > > > > > another example to make this clear: > > > > > > Let the given words be: > > > > > > CODEJAM > > NODEJAM > > MODEJAM > > JAM > > > > > > The longest common suffix to of at least 2 words currently is "ODEJAM". > > So if you choose to put the accent on the "O" of that suffix, then you can > > pair 2 words with that suffix: > > - either CODEJAM <==> NODEJAM > > - or CODEJAM <==> MODEJAM > > - or MODEJAM <==> NODEJAM > > > > > > BUT you can ONLY pair EXACTLY TWO of them. > > Lets choose to pair CODEJAM <==> NODEJAM. > > If you now remove all the words ending on "ODEJAM" only JAM will be left in > > the list of words and can not be paired. > > > > > > But MODEJAM and JAM are pairable with the accent suffix "JAM", so MUST > > NEVER remove UNPAIRED words, just because they share > > a suffix with a pair you already build, because there is a chance, that one > > of the unpaired words shares a SHORTER suffix with another > > unpaired word. > > > > > > Am Do., 25. Apr. 2019 um 13:30 Uhr schrieb Lasse : > > On Wednesday, April 24, 2019 at 7:28:41 PM UTC+2, Xiongqi ZHANG wrote: > > > > > why would you ignore “scent”? even though “scent” > > > > > also has “cent” as a suffix, it can still be used to match other words > > > with different suffix, e.g “went” with rhyme “ent”. > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, Apr 24, 2019 at 8:12 AM Lasse wrote: > > > > > Hi /dev/joe, > > > > > > > > > > > > > > > > > > > > thank you for the reply. I think our understanding is the same. With your > > > example, I first match rhyme "cent", which is shared by "cent" and > > > "recent", then "scent" must be ignored in the other matches, right? > > > > > > > > > > > > > > > > > > > > I did so and my submission is wrong, but when I retained "scent" and only > > > ignored "cent" and "recent", my code works with small dataset. > > > > > > > > > > > > > > > > > > > > Lasse > > > > > > > > > > > > > > > > > > > > On Tuesday, April 23, 2019 at 10:59:35 PM UTC+2, /dev/joe wrote: > > > > > > > > > > > The problem is about matching pairs of rhymes. Apparently we know that > > > > the poems in this alien language only ever use each rhyming-ending > > > > twice. Or maybe it's that we want to see how complex the rhyme scheme > > > > could be, in terms of different rhyming endings. Since rhymes are > > > > determined based on the location of an accent in the word, and we don't > > > > know where the accents go, you are placing the accents anywhere and > > > > trying to determine the maximum number of rhymes possible as a way of > > > > helping to decide whether these words are from a poem. Here's the > > > > relevant text from the problem: > > > > > > > > > > > > > > > > > > > > > > You believe that you can discard zero or more of these words, assign > > > > accented letters to the remaining words, and then arrange those words > > > > into pairs such that each word rhymes only with the other word in its > > > > pair, and with none of the words in other pairs. > > > > > > > > > > > > > > > > > > > > > > You want to know the largest number of words that can be arranged into > > > > pairs in this way. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Example: Suppose you get the words bent, cent, dent, gent, lent, rent, > > > > recent, sent, scent, tent, and went. > > > > > > > > > > > > > > > > > > > > > > You can make two words rhyme with ending t, two with nt, two with ent, > > > > and two with cent. You will have three leftover words, but no more > > > > common endings which are not already used, so you can't make another > > > > pair even though the words have a common ending. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Using the method of working from longest ending to shortest, you won't > > > > find any matches until you get to cent. There are three there, and you > > > > use and eliminate two and move on to the next ending. Then you get to > > > >
Re: [gcj] question about alien rhyme
Hi, I disagree with it, when "scent" is retained for rhyming with other words on letter "e" "n" or "t", the rule "and with none of the words in other pairs" makes no sense. The scent can be rhymed with "cent" in the first pair. On Thursday, April 25, 2019 at 2:44:37 PM UTC+2, /dev/joe wrote: > Remember that when you are rhyming words, you are assigning an accent on a > particular letter. So when you rhyme (C)ENT and RE(C)ENT, you can retain > SCENT and use it later putting the accent on the E to rhyme SC(E)NT and > W(E)NT. Now SC(E)NT does not rhyme with (C)ENT because the tail -(C)ENT is > different from the tail -(E)NT (or -C(E)NT for that matter). > > > In the case Samuel suggested: > Hey dev/joe what if the inputs are ,AA,,AAA,AA,A ? > should the output be 6? or 2 because the accented letter are the same... > > > > You rhyme the first two with the tail -(A)A, then next two with the tail > -(A)AA, and the last two with the tail -(A) and use all 6 words. > > > In the case I originally proposed, after you rhyme two words each with > -(C)ENT, -(E)NT, -(N)T, and -(T) there are words left over which end with > ENT, but there is nowhere you can assign accents for them which allows two of > them to rhyme but does not also rhyme with one of the already used pairs. > > > On Thu, Apr 25, 2019 at 7:30 AM Lasse wrote: > On Wednesday, April 24, 2019 at 7:28:41 PM UTC+2, Xiongqi ZHANG wrote: > > > why would you ignore “scent”? even though “scent” > > > also has “cent” as a suffix, it can still be used to match other words with > > different suffix, e.g “went” with rhyme “ent”. > > > > > > > > > > > > > > > On Wed, Apr 24, 2019 at 8:12 AM Lasse wrote: > > > Hi /dev/joe, > > > > > > > > > > > > thank you for the reply. I think our understanding is the same. With your > > example, I first match rhyme "cent", which is shared by "cent" and > > "recent", then "scent" must be ignored in the other matches, right? > > > > > > > > > > > > I did so and my submission is wrong, but when I retained "scent" and only > > ignored "cent" and "recent", my code works with small dataset. > > > > > > > > > > > > Lasse > > > > > > > > > > > > On Tuesday, April 23, 2019 at 10:59:35 PM UTC+2, /dev/joe wrote: > > > > > > > The problem is about matching pairs of rhymes. Apparently we know that > > > the poems in this alien language only ever use each rhyming-ending twice. > > > Or maybe it's that we want to see how complex the rhyme scheme could be, > > > in terms of different rhyming endings. Since rhymes are determined based > > > on the location of an accent in the word, and we don't know where the > > > accents go, you are placing the accents anywhere and trying to determine > > > the maximum number of rhymes possible as a way of helping to decide > > > whether these words are from a poem. Here's the relevant text from the > > > problem: > > > > > > > > > > > > > > You believe that you can discard zero or more of these words, assign > > > accented letters to the remaining words, and then arrange those words > > > into pairs such that each word rhymes only with the other word in its > > > pair, and with none of the words in other pairs. > > > > > > > > > > > > > > You want to know the largest number of words that can be arranged into > > > pairs in this way. > > > > > > > > > > > > > > > > > > > > > > > > > > > > Example: Suppose you get the words bent, cent, dent, gent, lent, rent, > > > recent, sent, scent, tent, and went. > > > > > > > > > > > > > > You can make two words rhyme with ending t, two with nt, two with ent, > > > and two with cent. You will have three leftover words, but no more common > > > endings which are not already used, so you can't make another pair even > > > though the words have a common ending. > > > > > > > > > > > > > > > > > > > > > Using the method of working from longest ending to shortest, you won't > > > find any matches until you get to cent. There are three there, and you > > > use and eliminate two and move on to the next ending. Then you get to > > > ent, nt, and t, each of which have all the remaining words at that time. > > > You use two each time, any two, and move on. When you are done, you have > > > three words, each of which ends with t, nt, ent, and maybe even one of > > > them with cent, but you are not allowed to rhyme more than two words with > > > any ending, so you can't use them. > > > > > > > > > > > > > > > > > > > > > If ascent was added to the list, you could rhyme ascent with scent (based > > > on the ending scent), recent with cent, and three more pairs with the > > > shorter endings, allowing you to use 10 words, but you would still have > > > two left over which match their final three letters but can't be used > > > because they don't have any common endings that are not already used. > > > > > > > >
Re: [gcj] question about alien rhyme
Hi, thank you for the example. In this case, I think we should make a pair with "ODEJAM" and only this one. When the other word is matched to "JAM" with "JAM", then the rule "and with none of the words in other pairs" is invalid. On Friday, April 26, 2019 at 12:30:07 PM UTC+2, DahliaSR wrote: > Hi Lasse, > > > another example to make this clear: > > > Let the given words be: > > > CODEJAM > NODEJAM > MODEJAM > JAM > > > The longest common suffix to of at least 2 words currently is "ODEJAM". > So if you choose to put the accent on the "O" of that suffix, then you can > pair 2 words with that suffix: > - either CODEJAM <==> NODEJAM > - or CODEJAM <==> MODEJAM > - or MODEJAM <==> NODEJAM > > > BUT you can ONLY pair EXACTLY TWO of them. > Lets choose to pair CODEJAM <==> NODEJAM. > If you now remove all the words ending on "ODEJAM" only JAM will be left in > the list of words and can not be paired. > > > But MODEJAM and JAM are pairable with the accent suffix "JAM", so MUST NEVER > remove UNPAIRED words, just because they share > a suffix with a pair you already build, because there is a chance, that one > of the unpaired words shares a SHORTER suffix with another > unpaired word. > > > Am Do., 25. Apr. 2019 um 13:30 Uhr schrieb Lasse : > On Wednesday, April 24, 2019 at 7:28:41 PM UTC+2, Xiongqi ZHANG wrote: > > > why would you ignore “scent”? even though “scent” > > > also has “cent” as a suffix, it can still be used to match other words with > > different suffix, e.g “went” with rhyme “ent”. > > > > > > > > > > > > > > > On Wed, Apr 24, 2019 at 8:12 AM Lasse wrote: > > > Hi /dev/joe, > > > > > > > > > > > > thank you for the reply. I think our understanding is the same. With your > > example, I first match rhyme "cent", which is shared by "cent" and > > "recent", then "scent" must be ignored in the other matches, right? > > > > > > > > > > > > I did so and my submission is wrong, but when I retained "scent" and only > > ignored "cent" and "recent", my code works with small dataset. > > > > > > > > > > > > Lasse > > > > > > > > > > > > On Tuesday, April 23, 2019 at 10:59:35 PM UTC+2, /dev/joe wrote: > > > > > > > The problem is about matching pairs of rhymes. Apparently we know that > > > the poems in this alien language only ever use each rhyming-ending twice. > > > Or maybe it's that we want to see how complex the rhyme scheme could be, > > > in terms of different rhyming endings. Since rhymes are determined based > > > on the location of an accent in the word, and we don't know where the > > > accents go, you are placing the accents anywhere and trying to determine > > > the maximum number of rhymes possible as a way of helping to decide > > > whether these words are from a poem. Here's the relevant text from the > > > problem: > > > > > > > > > > > > > > You believe that you can discard zero or more of these words, assign > > > accented letters to the remaining words, and then arrange those words > > > into pairs such that each word rhymes only with the other word in its > > > pair, and with none of the words in other pairs. > > > > > > > > > > > > > > You want to know the largest number of words that can be arranged into > > > pairs in this way. > > > > > > > > > > > > > > > > > > > > > > > > > > > > Example: Suppose you get the words bent, cent, dent, gent, lent, rent, > > > recent, sent, scent, tent, and went. > > > > > > > > > > > > > > You can make two words rhyme with ending t, two with nt, two with ent, > > > and two with cent. You will have three leftover words, but no more common > > > endings which are not already used, so you can't make another pair even > > > though the words have a common ending. > > > > > > > > > > > > > > > > > > > > > Using the method of working from longest ending to shortest, you won't > > > find any matches until you get to cent. There are three there, and you > > > use and eliminate two and move on to the next ending. Then you get to > > > ent, nt, and t, each of which have all the remaining words at that time. > > > You use two each time, any two, and move on. When you are done, you have > > > three words, each of which ends with t, nt, ent, and maybe even one of > > > them with cent, but you are not allowed to rhyme more than two words with > > > any ending, so you can't use them. > > > > > > > > > > > > > > > > > > > > > If ascent was added to the list, you could rhyme ascent with scent (based > > > on the ending scent), recent with cent, and three more pairs with the > > > shorter endings, allowing you to use 10 words, but you would still have > > > two left over which match their final three letters but can't be used > > > because they don't have any common endings that are not already used. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Tue, Apr 23,
Re: [gcj] question about alien rhyme
Hi Lasse, another example to make this clear: Let the given words be: CODEJAM NODEJAM MODEJAM JAM The longest common suffix to of at least 2 words currently is "ODEJAM". So if you choose to put the accent on the "O" of that suffix, then you can pair 2 words with that suffix: - either CODEJAM <==> NODEJAM - or CODEJAM <==> MODEJAM - or MODEJAM <==> NODEJAM BUT you can ONLY pair EXACTLY TWO of them. Lets choose to pair CODEJAM <==> NODEJAM. If you now remove all the words ending on "ODEJAM" only JAM will be left in the list of words and can not be paired. But MODEJAM and JAM are pairable with the accent suffix "JAM", so MUST NEVER remove UNPAIRED words, just because they share a suffix with a pair you already build, because there is a chance, that one of the unpaired words shares a SHORTER suffix with another unpaired word. Am Do., 25. Apr. 2019 um 13:30 Uhr schrieb Lasse : > On Wednesday, April 24, 2019 at 7:28:41 PM UTC+2, Xiongqi ZHANG wrote: > > why would you ignore “scent”? even though “scent” > > also has “cent” as a suffix, it can still be used to match other words > with different suffix, e.g “went” with rhyme “ent”. > > > > > > > > > > On Wed, Apr 24, 2019 at 8:12 AM Lasse wrote: > > Hi /dev/joe, > > > > > > > > thank you for the reply. I think our understanding is the same. With > your example, I first match rhyme "cent", which is shared by "cent" and > "recent", then "scent" must be ignored in the other matches, right? > > > > > > > > I did so and my submission is wrong, but when I retained "scent" and > only ignored "cent" and "recent", my code works with small dataset. > > > > > > > > Lasse > > > > > > > > On Tuesday, April 23, 2019 at 10:59:35 PM UTC+2, /dev/joe wrote: > > > > > The problem is about matching pairs of rhymes. Apparently we know that > the poems in this alien language only ever use each rhyming-ending twice. > Or maybe it's that we want to see how complex the rhyme scheme could be, in > terms of different rhyming endings. Since rhymes are determined based on > the location of an accent in the word, and we don't know where the accents > go, you are placing the accents anywhere and trying to determine the > maximum number of rhymes possible as a way of helping to decide whether > these words are from a poem. Here's the relevant text from the problem: > > > > > > > > > > You believe that you can discard zero or more of these words, assign > accented letters to the remaining words, and then arrange those words into > pairs such that each word rhymes only with the other word in its pair, and > with none of the words in other pairs. > > > > > > > > > > You want to know the largest number of words that can be arranged into > pairs in this way. > > > > > > > > > > > > > > > > > > > > Example: Suppose you get the words bent, cent, dent, gent, lent, rent, > recent, sent, scent, tent, and went. > > > > > > > > > > You can make two words rhyme with ending t, two with nt, two with ent, > and two with cent. You will have three leftover words, but no more common > endings which are not already used, so you can't make another pair even > though the words have a common ending. > > > > > > > > > > > > > > > Using the method of working from longest ending to shortest, you won't > find any matches until you get to cent. There are three there, and you use > and eliminate two and move on to the next ending. Then you get to ent, nt, > and t, each of which have all the remaining words at that time. You use two > each time, any two, and move on. When you are done, you have three words, > each of which ends with t, nt, ent, and maybe even one of them with cent, > but you are not allowed to rhyme more than two words with any ending, so > you can't use them. > > > > > > > > > > > > > > > If ascent was added to the list, you could rhyme ascent with scent > (based on the ending scent), recent with cent, and three more pairs with > the shorter endings, allowing you to use 10 words, but you would still have > two left over which match their final three letters but can't be used > because they don't have any common endings that are not already used. > > > > > > > > > > > > > > > > > > > > > > > > > On Tue, Apr 23, 2019 at 2:04 PM Lasse wrote: > > > > > I was playing with the question Alien Rhyme in round 1a 2019 and found > > > > > > > > > > something strange. Please correct me if I was wrong or remind me when > it > > > > > > > > > > is already discussed. > > > > > > > > > > > > > > > > > > > > I tried to collect all matched rhymes and select from longest to > > > > > > > > > > shortest, but when I filter all matched (with rhyme), the small dataset > > > > > > > > > > failed; but when I removed only the first two matched words, at least > > > > > > > > > > the small dataset succeeded. Actually I tried to use the method from > > > > > > > > > > ACRushTC, when I used a similar method, both datasets passed when I > > > > > > > > > > removed the first two matched but both failed when I
Re: [gcj] question about alien rhyme
Remember that when you are rhyming words, you are assigning an accent on a particular letter. So when you rhyme (C)ENT and RE(C)ENT, you can retain SCENT and use it later putting the accent on the E to rhyme SC(E)NT and W(E)NT. Now SC(E)NT does not rhyme with (C)ENT because the tail -(C)ENT is different from the tail -(E)NT (or -C(E)NT for that matter). In the case Samuel suggested: Hey dev/joe what if the inputs are ,AA,,AAA,AA,A ? should the output be 6? or 2 because the accented letter are the same... You rhyme the first two with the tail -(A)A, then next two with the tail -(A)AA, and the last two with the tail -(A) and use all 6 words. In the case I originally proposed, after you rhyme two words each with -(C)ENT, -(E)NT, -(N)T, and -(T) there are words left over which end with ENT, but there is nowhere you can assign accents for them which allows two of them to rhyme but does not also rhyme with one of the already used pairs. On Thu, Apr 25, 2019 at 7:30 AM Lasse wrote: > On Wednesday, April 24, 2019 at 7:28:41 PM UTC+2, Xiongqi ZHANG wrote: > > why would you ignore “scent”? even though “scent” > > also has “cent” as a suffix, it can still be used to match other words > with different suffix, e.g “went” with rhyme “ent”. > > > > > > > > > > On Wed, Apr 24, 2019 at 8:12 AM Lasse wrote: > > Hi /dev/joe, > > > > > > > > thank you for the reply. I think our understanding is the same. With > your example, I first match rhyme "cent", which is shared by "cent" and > "recent", then "scent" must be ignored in the other matches, right? > > > > > > > > I did so and my submission is wrong, but when I retained "scent" and > only ignored "cent" and "recent", my code works with small dataset. > > > > > > > > Lasse > > > > > > > > On Tuesday, April 23, 2019 at 10:59:35 PM UTC+2, /dev/joe wrote: > > > > > The problem is about matching pairs of rhymes. Apparently we know that > the poems in this alien language only ever use each rhyming-ending twice. > Or maybe it's that we want to see how complex the rhyme scheme could be, in > terms of different rhyming endings. Since rhymes are determined based on > the location of an accent in the word, and we don't know where the accents > go, you are placing the accents anywhere and trying to determine the > maximum number of rhymes possible as a way of helping to decide whether > these words are from a poem. Here's the relevant text from the problem: > > > > > > > > > > You believe that you can discard zero or more of these words, assign > accented letters to the remaining words, and then arrange those words into > pairs such that each word rhymes only with the other word in its pair, and > with none of the words in other pairs. > > > > > > > > > > You want to know the largest number of words that can be arranged into > pairs in this way. > > > > > > > > > > > > > > > > > > > > Example: Suppose you get the words bent, cent, dent, gent, lent, rent, > recent, sent, scent, tent, and went. > > > > > > > > > > You can make two words rhyme with ending t, two with nt, two with ent, > and two with cent. You will have three leftover words, but no more common > endings which are not already used, so you can't make another pair even > though the words have a common ending. > > > > > > > > > > > > > > > Using the method of working from longest ending to shortest, you won't > find any matches until you get to cent. There are three there, and you use > and eliminate two and move on to the next ending. Then you get to ent, nt, > and t, each of which have all the remaining words at that time. You use two > each time, any two, and move on. When you are done, you have three words, > each of which ends with t, nt, ent, and maybe even one of them with cent, > but you are not allowed to rhyme more than two words with any ending, so > you can't use them. > > > > > > > > > > > > > > > If ascent was added to the list, you could rhyme ascent with scent > (based on the ending scent), recent with cent, and three more pairs with > the shorter endings, allowing you to use 10 words, but you would still have > two left over which match their final three letters but can't be used > because they don't have any common endings that are not already used. > > > > > > > > > > > > > > > > > > > > > > > > > On Tue, Apr 23, 2019 at 2:04 PM Lasse wrote: > > > > > I was playing with the question Alien Rhyme in round 1a 2019 and found > > > > > > > > > > something strange. Please correct me if I was wrong or remind me when > it > > > > > > > > > > is already discussed. > > > > > > > > > > > > > > > > > > > > I tried to collect all matched rhymes and select from longest to > > > > > > > > > > shortest, but when I filter all matched (with rhyme), the small dataset > > > > > > > > > > failed; but when I removed only the first two matched words, at least > > > > > > > > > > the small dataset succeeded. Actually I tried to use the method from > > > > > > > > > > ACRushTC, when I used a similar
Re: [gcj] question about alien rhyme
On Wednesday, 24 April 2019 03:59:35 UTC+7, /dev/joe wrote: > The problem is about matching pairs of rhymes. Apparently we know that the > poems in this alien language only ever use each rhyming-ending twice. Or > maybe it's that we want to see how complex the rhyme scheme could be, in > terms of different rhyming endings. Since rhymes are determined based on the > location of an accent in the word, and we don't know where the accents go, > you are placing the accents anywhere and trying to determine the maximum > number of rhymes possible as a way of helping to decide whether these words > are from a poem. Here's the relevant text from the problem: > > You believe that you can discard zero or more of these words, assign accented > letters to the remaining words, and then arrange those words into pairs such > that each word rhymes only with the other word in its pair, and with none of > the words in other pairs. > > You want to know the largest number of words that can be arranged into pairs > in this way. > > > > Example: Suppose you get the words bent, cent, dent, gent, lent, rent, > recent, sent, scent, tent, and went. > > You can make two words rhyme with ending t, two with nt, two with ent, and > two with cent. You will have three leftover words, but no more common endings > which are not already used, so you can't make another pair even though the > words have a common ending. > > > Using the method of working from longest ending to shortest, you won't find > any matches until you get to cent. There are three there, and you use and > eliminate two and move on to the next ending. Then you get to ent, nt, and t, > each of which have all the remaining words at that time. You use two each > time, any two, and move on. When you are done, you have three words, each of > which ends with t, nt, ent, and maybe even one of them with cent, but you are > not allowed to rhyme more than two words with any ending, so you can't use > them. > > > If ascent was added to the list, you could rhyme ascent with scent (based on > the ending scent), recent with cent, and three more pairs with the shorter > endings, allowing you to use 10 words, but you would still have two left over > which match their final three letters but can't be used because they don't > have any common endings that are not already used. > > > > > On Tue, Apr 23, 2019 at 2:04 PM Lasse wrote: > I was playing with the question Alien Rhyme in round 1a 2019 and found > > something strange. Please correct me if I was wrong or remind me when it > > is already discussed. > > > > I tried to collect all matched rhymes and select from longest to > > shortest, but when I filter all matched (with rhyme), the small dataset > > failed; but when I removed only the first two matched words, at least > > the small dataset succeeded. Actually I tried to use the method from > > ACRushTC, when I used a similar method, both datasets passed when I > > removed the first two matched but both failed when I removed all > > matched. Did I understand the question in the wrong way? As I > > understood, the words which have longer rhyme will be ignored. > > > > -- > > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > > To unsubscribe from this group and stop receiving emails from it, send an > email to googl...@googlegroups.com. > > To post to this group, send email to googl...@googlegroups.com. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-code/d8d001bc-124e-45cb-bfb5-3a6d1482b1f3%40googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. Hey dev/joe what if the inputs are ,AA,,AAA,AA,A ? should the output be 6? or 2 because the accented letter are the same... -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-code+unsubscr...@googlegroups.com. To post to this group, send email to google-code@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/7f8e914f-0828-4f30-bfcf-6cadc99e74e8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [gcj] question about alien rhyme
On Wednesday, April 24, 2019 at 7:28:41 PM UTC+2, Xiongqi ZHANG wrote: > why would you ignore “scent”? even though “scent” > also has “cent” as a suffix, it can still be used to match other words with > different suffix, e.g “went” with rhyme “ent”. > > > > > On Wed, Apr 24, 2019 at 8:12 AM Lasse wrote: > Hi /dev/joe, > > > > thank you for the reply. I think our understanding is the same. With your > example, I first match rhyme "cent", which is shared by "cent" and "recent", > then "scent" must be ignored in the other matches, right? > > > > I did so and my submission is wrong, but when I retained "scent" and only > ignored "cent" and "recent", my code works with small dataset. > > > > Lasse > > > > On Tuesday, April 23, 2019 at 10:59:35 PM UTC+2, /dev/joe wrote: > > > The problem is about matching pairs of rhymes. Apparently we know that the > > poems in this alien language only ever use each rhyming-ending twice. Or > > maybe it's that we want to see how complex the rhyme scheme could be, in > > terms of different rhyming endings. Since rhymes are determined based on > > the location of an accent in the word, and we don't know where the accents > > go, you are placing the accents anywhere and trying to determine the > > maximum number of rhymes possible as a way of helping to decide whether > > these words are from a poem. Here's the relevant text from the problem: > > > > > > You believe that you can discard zero or more of these words, assign > > accented letters to the remaining words, and then arrange those words into > > pairs such that each word rhymes only with the other word in its pair, and > > with none of the words in other pairs. > > > > > > You want to know the largest number of words that can be arranged into > > pairs in this way. > > > > > > > > > > > > Example: Suppose you get the words bent, cent, dent, gent, lent, rent, > > recent, sent, scent, tent, and went. > > > > > > You can make two words rhyme with ending t, two with nt, two with ent, and > > two with cent. You will have three leftover words, but no more common > > endings which are not already used, so you can't make another pair even > > though the words have a common ending. > > > > > > > > > Using the method of working from longest ending to shortest, you won't find > > any matches until you get to cent. There are three there, and you use and > > eliminate two and move on to the next ending. Then you get to ent, nt, and > > t, each of which have all the remaining words at that time. You use two > > each time, any two, and move on. When you are done, you have three words, > > each of which ends with t, nt, ent, and maybe even one of them with cent, > > but you are not allowed to rhyme more than two words with any ending, so > > you can't use them. > > > > > > > > > If ascent was added to the list, you could rhyme ascent with scent (based > > on the ending scent), recent with cent, and three more pairs with the > > shorter endings, allowing you to use 10 words, but you would still have two > > left over which match their final three letters but can't be used because > > they don't have any common endings that are not already used. > > > > > > > > > > > > > > > On Tue, Apr 23, 2019 at 2:04 PM Lasse wrote: > > > I was playing with the question Alien Rhyme in round 1a 2019 and found > > > > > > something strange. Please correct me if I was wrong or remind me when it > > > > > > is already discussed. > > > > > > > > > > > > I tried to collect all matched rhymes and select from longest to > > > > > > shortest, but when I filter all matched (with rhyme), the small dataset > > > > > > failed; but when I removed only the first two matched words, at least > > > > > > the small dataset succeeded. Actually I tried to use the method from > > > > > > ACRushTC, when I used a similar method, both datasets passed when I > > > > > > removed the first two matched but both failed when I removed all > > > > > > matched. Did I understand the question in the wrong way? As I > > > > > > understood, the words which have longer rhyme will be ignored. > > > > > > > > > > > > -- > > > > > > You received this message because you are subscribed to the Google Groups > > "Google Code Jam" group. > > > > > > To unsubscribe from this group and stop receiving emails from it, send an > > email to googl...@googlegroups.com. > > > > > > To post to this group, send email to googl...@googlegroups.com. > > > > > > To view this discussion on the web visit > > https://groups.google.com/d/msgid/google-code/d8d001bc-124e-45cb-bfb5-3a6d1482b1f3%40googlegroups.com. > > > > > > For more options, visit https://groups.google.com/d/optout. > > > > -- > > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > > To unsubscribe from this group and stop receiving emails from it,
Re: [gcj] question about alien rhyme
why would you ignore “scent”? even though “scent” also has “cent” as a suffix, it can still be used to match other words with different suffix, e.g “went” with rhyme “ent”. On Wed, Apr 24, 2019 at 8:12 AM Lasse wrote: > Hi /dev/joe, > > thank you for the reply. I think our understanding is the same. With your > example, I first match rhyme "cent", which is shared by "cent" and > "recent", then "scent" must be ignored in the other matches, right? > > I did so and my submission is wrong, but when I retained "scent" and only > ignored "cent" and "recent", my code works with small dataset. > > Lasse > > On Tuesday, April 23, 2019 at 10:59:35 PM UTC+2, /dev/joe wrote: > > The problem is about matching pairs of rhymes. Apparently we know that > the poems in this alien language only ever use each rhyming-ending twice. > Or maybe it's that we want to see how complex the rhyme scheme could be, in > terms of different rhyming endings. Since rhymes are determined based on > the location of an accent in the word, and we don't know where the accents > go, you are placing the accents anywhere and trying to determine the > maximum number of rhymes possible as a way of helping to decide whether > these words are from a poem. Here's the relevant text from the problem: > > > > You believe that you can discard zero or more of these words, assign > accented letters to the remaining words, and then arrange those words into > pairs such that each word rhymes only with the other word in its pair, and > with none of the words in other pairs. > > > > You want to know the largest number of words that can be arranged into > pairs in this way. > > > > > > > > Example: Suppose you get the words bent, cent, dent, gent, lent, rent, > recent, sent, scent, tent, and went. > > > > You can make two words rhyme with ending t, two with nt, two with ent, > and two with cent. You will have three leftover words, but no more common > endings which are not already used, so you can't make another pair even > though the words have a common ending. > > > > > > Using the method of working from longest ending to shortest, you won't > find any matches until you get to cent. There are three there, and you use > and eliminate two and move on to the next ending. Then you get to ent, nt, > and t, each of which have all the remaining words at that time. You use two > each time, any two, and move on. When you are done, you have three words, > each of which ends with t, nt, ent, and maybe even one of them with cent, > but you are not allowed to rhyme more than two words with any ending, so > you can't use them. > > > > > > If ascent was added to the list, you could rhyme ascent with scent > (based on the ending scent), recent with cent, and three more pairs with > the shorter endings, allowing you to use 10 words, but you would still have > two left over which match their final three letters but can't be used > because they don't have any common endings that are not already used. > > > > > > > > > > On Tue, Apr 23, 2019 at 2:04 PM Lasse wrote: > > I was playing with the question Alien Rhyme in round 1a 2019 and found > > > > something strange. Please correct me if I was wrong or remind me when it > > > > is already discussed. > > > > > > > > I tried to collect all matched rhymes and select from longest to > > > > shortest, but when I filter all matched (with rhyme), the small dataset > > > > failed; but when I removed only the first two matched words, at least > > > > the small dataset succeeded. Actually I tried to use the method from > > > > ACRushTC, when I used a similar method, both datasets passed when I > > > > removed the first two matched but both failed when I removed all > > > > matched. Did I understand the question in the wrong way? As I > > > > understood, the words which have longer rhyme will be ignored. > > > > > > > > -- > > > > You received this message because you are subscribed to the Google > Groups "Google Code Jam" group. > > > > To unsubscribe from this group and stop receiving emails from it, send > an email to googl...@googlegroups.com. > > > > To post to this group, send email to googl...@googlegroups.com. > > > > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-code/d8d001bc-124e-45cb-bfb5-3a6d1482b1f3%40googlegroups.com > . > > > > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to google-code+unsubscr...@googlegroups.com. > To post to this group, send email to google-code@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-code/73c01868-d7e5-430d-a130-78efac477b76%40googlegroups.com > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Google
Re: [gcj] question about alien rhyme
Hi /dev/joe, thank you for the reply. I think our understanding is the same. With your example, I first match rhyme "cent", which is shared by "cent" and "recent", then "scent" must be ignored in the other matches, right? I did so and my submission is wrong, but when I retained "scent" and only ignored "cent" and "recent", my code works with small dataset. Lasse On Tuesday, April 23, 2019 at 10:59:35 PM UTC+2, /dev/joe wrote: > The problem is about matching pairs of rhymes. Apparently we know that the > poems in this alien language only ever use each rhyming-ending twice. Or > maybe it's that we want to see how complex the rhyme scheme could be, in > terms of different rhyming endings. Since rhymes are determined based on the > location of an accent in the word, and we don't know where the accents go, > you are placing the accents anywhere and trying to determine the maximum > number of rhymes possible as a way of helping to decide whether these words > are from a poem. Here's the relevant text from the problem: > > You believe that you can discard zero or more of these words, assign accented > letters to the remaining words, and then arrange those words into pairs such > that each word rhymes only with the other word in its pair, and with none of > the words in other pairs. > > You want to know the largest number of words that can be arranged into pairs > in this way. > > > > Example: Suppose you get the words bent, cent, dent, gent, lent, rent, > recent, sent, scent, tent, and went. > > You can make two words rhyme with ending t, two with nt, two with ent, and > two with cent. You will have three leftover words, but no more common endings > which are not already used, so you can't make another pair even though the > words have a common ending. > > > Using the method of working from longest ending to shortest, you won't find > any matches until you get to cent. There are three there, and you use and > eliminate two and move on to the next ending. Then you get to ent, nt, and t, > each of which have all the remaining words at that time. You use two each > time, any two, and move on. When you are done, you have three words, each of > which ends with t, nt, ent, and maybe even one of them with cent, but you are > not allowed to rhyme more than two words with any ending, so you can't use > them. > > > If ascent was added to the list, you could rhyme ascent with scent (based on > the ending scent), recent with cent, and three more pairs with the shorter > endings, allowing you to use 10 words, but you would still have two left over > which match their final three letters but can't be used because they don't > have any common endings that are not already used. > > > > > On Tue, Apr 23, 2019 at 2:04 PM Lasse wrote: > I was playing with the question Alien Rhyme in round 1a 2019 and found > > something strange. Please correct me if I was wrong or remind me when it > > is already discussed. > > > > I tried to collect all matched rhymes and select from longest to > > shortest, but when I filter all matched (with rhyme), the small dataset > > failed; but when I removed only the first two matched words, at least > > the small dataset succeeded. Actually I tried to use the method from > > ACRushTC, when I used a similar method, both datasets passed when I > > removed the first two matched but both failed when I removed all > > matched. Did I understand the question in the wrong way? As I > > understood, the words which have longer rhyme will be ignored. > > > > -- > > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > > To unsubscribe from this group and stop receiving emails from it, send an > email to googl...@googlegroups.com. > > To post to this group, send email to googl...@googlegroups.com. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-code/d8d001bc-124e-45cb-bfb5-3a6d1482b1f3%40googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-code+unsubscr...@googlegroups.com. To post to this group, send email to google-code@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/73c01868-d7e5-430d-a130-78efac477b76%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [gcj] question about alien rhyme
The problem is about matching pairs of rhymes. Apparently we know that the poems in this alien language only ever use each rhyming-ending twice. Or maybe it's that we want to see how complex the rhyme scheme could be, in terms of different rhyming endings. Since rhymes are determined based on the location of an accent in the word, and we don't know where the accents go, you are placing the accents anywhere and trying to determine the maximum number of rhymes possible as a way of helping to decide whether these words are from a poem. Here's the relevant text from the problem: You believe that you can discard zero or more of these words, assign accented letters to the remaining words, and then arrange those words into pairs such that *each word rhymes only with the other word in its pair, and with none of the words in other pairs.* You want to know the largest number of words that can be arranged into pairs in this way. Example: Suppose you get the words bent, cent, dent, gent, lent, rent, recent, sent, scent, tent, and went. You can make two words rhyme with ending t, two with nt, two with ent, and two with cent. You will have three leftover words, but no more common endings which are not already used, so you can't make another pair even though the words have a common ending. Using the method of working from longest ending to shortest, you won't find any matches until you get to cent. There are three there, and you use and eliminate two and move on to the next ending. Then you get to ent, nt, and t, each of which have all the remaining words at that time. You use two each time, any two, and move on. When you are done, you have three words, each of which ends with t, nt, ent, and maybe even one of them with cent, but you are not allowed to rhyme more than two words with any ending, so you can't use them. If ascent was added to the list, you could rhyme ascent with scent (based on the ending scent), recent with cent, and three more pairs with the shorter endings, allowing you to use 10 words, but you would still have two left over which match their final three letters but can't be used because they don't have any common endings that are not already used. On Tue, Apr 23, 2019 at 2:04 PM Lasse wrote: > I was playing with the question Alien Rhyme in round 1a 2019 and found > something strange. Please correct me if I was wrong or remind me when it > is already discussed. > > I tried to collect all matched rhymes and select from longest to > shortest, but when I filter all matched (with rhyme), the small dataset > failed; but when I removed only the first two matched words, at least > the small dataset succeeded. Actually I tried to use the method from > ACRushTC, when I used a similar method, both datasets passed when I > removed the first two matched but both failed when I removed all > matched. Did I understand the question in the wrong way? As I > understood, the words which have longer rhyme will be ignored. > > -- > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to google-code+unsubscr...@googlegroups.com. > To post to this group, send email to google-code@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-code/d8d001bc-124e-45cb-bfb5-3a6d1482b1f3%40googlegroups.com > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-code+unsubscr...@googlegroups.com. To post to this group, send email to google-code@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/CAMAzhzguM6koNt5JPg-eJOkhBC_eQLKJnxr6kMbSTfocFpNGYA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.