|
|
There were mentioned, that it is required 64-bit integer type. I also add, that it has to be unsigned, otherwise you get WA 8. we dont know use the locomotive as a carriage, like: input: 1 1 AA AB output: NO GOOD LUCK!!! Thank you! I got WA#14 but it's in past. =) Thanks too! I've got WA#14 in the past and I've got AC now. It means, be careful that the end should be the same as the locomotive. e.g. if the locomotive is "AA" then the last should be "AA" or "BA", such as "ABBA" with locomotive "AA" is correct but "ABBA" with locomotive "BA" is incorrect. (sorry for my bad English) Thanks! I got WA on Test #14 After reading this,I know my understanding was wrong AC in 0.015 sec with dp if u r better with math plz reply Edited by author 07.04.2021 13:27 Edited by author 07.04.2021 13:27 Edited by author 07.04.2021 13:27 AA=0,AB=1,BA=2,BB=3 cnt[0]=no. of AA,cnt[1]=no. of AB........... int sz=2; if(last letter==A) szvalue=0; if(last letter==B) szvalue=2; define DP[cnt[0]+2][cnt[1]+2][cnt[2]+2][cnt[3]+2][sz]; dp 1,0,0,0,0=1; //for AA dp 0,1,0,0,1=1; //for AB It is said "Tags: dynamic programming" But also there is math approach. In this case solution is simple math formula kind of \sum\sum C(x,y)*C(t,m). Complexity is O(n^2). Good luck. my email is LiuyangElvis@gmail.com thanks for help! 10 7 BA AA AA AA AA AA AB AB AB AB AB ANSWER:NO Good luck! i got this on test 08. Does anyone know the test? I tried building solution by taking two matrices dpA[i][j] which tells me the count including the carriages from 1 to i of length k ending at A. Similarly I constructed dpB[i][j] (somewhat similar to 0-1 knapsack). But of course this is wrong as my output will depend on the ordering of the carriages in input. Any suggestions if this approach can be corrected or need to think in completely different direction? Thanks! To solve this problem we must use 64-bit variable. When i wrote in my code "printf("%lld\n",res)" i've got WA on test number 7. But when i wrote "cout<<res<<endl",i've got AC. My friend had the same problem. So what does it mean? Sorry, i must be more careful and write "printf("%I64d\n",res)". No, you should use 64 bit type. Well I really don't know where my mistake is.... My solution becomes right solution for a test case like this: IN: 40 39 AB BA AB BB AA AA BB BB BB AA AA AB BA AB BA AB BA AB BA AB BA BA AB BB AA AA BB BB BB AA AA AB BA AB BA AB BA AB BA AB BA OUT: YES EDIT:(5712638724) - my mistake ( i hope this test case is right :) But what ever I do... I become WA on test 4 :S Edited by author 13.04.2009 23:49 Your solution is wrong. My program outputs 5712638724 You are right... My solution ouputs the same. Something is wrong with printf("%lld") on my PC :S The problem continues... WA #4 Edited by author 13.04.2009 23:50 IN: 40 39 AB AB AB AB AB AB AB AB AB AB AB BA BA BA BA BA BA BA BA BA BA AA AA AA AA AA AA AA AA AA AA BB BB BB BB BB BB BB BB BB BB OUT: 8533694884 ???????????????????? If this test case is right then i don't know where i made a mistake in my code :S Thats really frustrating Edited by author 15.04.2009 01:10 Well i needed about 20 submissions to find out the 4 test case.... Now... How can it be that my solution becomes Wrong Result when he outputs the right answer ??? When i make if(n==28 && k==28)cout<<"YES"<<endl<<5889312<<endl; then i become AC on the 4 test case But when my program outputs his result i got WA... but i tested it 4 times on my PC and my solution writes the same answer: 5889312.... thats really frustrating.....reallyy.... Can someone tell me what's wrong???? P.S if someone want's that i post the fourth test case then tell me..... Edited by author 16.04.2009 02:18 Well I'm sure now that something is different between my computer and the judge PC... How can my solution become WA on test case 4, when i get the right answer on my PC??? please... need big help... This one's bugging me as well... Edited by author 22.04.2009 21:58 Simple questiong :D I just can't get it, how should we connect carriages? If we have "AA" "BA" "AB" what can we connect "AABA" or "AAAB"??? What answer must be in this input???: 7 7 AA AA AB AB AB BA BA BA YES 4 Why not YES 6 ? AAAAABBAABBAAB ABBAAAAAABBAAB ABBAABBAAAAAAB AAABBAAAABBAAB ABBAAAABBAAAAB AAABBAABBAAAAB AA(the first one) is the locomotive , not BA(the last one). And your answer made me puzzled for a long time! :( Submit ID is 892925 :( Pascal solution has Fail(Validator) too. (Submit 892937). |
|
|