Общий форумWe cannot imagine the test where our prog will give wrong answer! I wonder too, always wa on test 2 1w1 01w01a Edited by author 24.04.2007 19:29 No, its not 2nd test. My prog correctly process it, but stil WA2. sorted: 01w01 01w1 01w01a z000 z00 z00p z0p and one more 0 0p 01 1 1p Edited by author 25.04.2007 20:03 Yeap, that`s it... Thx. Try this test: z0p z00pp z0pp z00pp00 z000pp01 z00pp01 z0pp01 z001pp00 z01pp00 z1pp00000 z01pp01 z1pp001pp0 z1pp01pp000 I get WA#2 too. Huge thanks to Alexander Kouprin, after running his test and solving the problem I got accepted. Test from Alexander Georgiev also helped me a lot. By the way, my program gives other output for some test from this thread. Here they are: abc00125a abc0125a abc00125b abc0125b abc000000000000000000000125a abc00000000000000000000125a abc0012000000000000000000000000005b abc012000000000000000000000000005b These tests have almost broken my mind while I have been thinking why they are correct and I'm happy that I do not have to fix my program because of them. Zeroes matters only if strings are equal. Try this: abc0125a abc00125a abc00125b abc0125b Try this: abc0125a abc00125a abc00125b abc0125b I suppose the last test by Peter Huggy is the most similar to second test but after all this tests WA6 Try this: abc00000000000000000000125a abc000000000000000000000125a abc0012000000000000000000000000005b abc012000000000000000000000000005b I suppose the last test by Peter Huggy is the most similar to second test but after all this tests WA6 Got AC, thanks to Alias tests :) You can also try: 0000000 000 (Already sorted) Thank to everybody! =) Your program must return for these tests next results (alredy sorted): 1) 000 00 0 2) 00 0 000a 3) 00a000 00a0 I don't understand this. Why is 0000000 smaller than 000? What's the logic behind it? Edited by author 12.01.2021 22:30 I think logic behind it is when strings are equal on "japanese" interchanging alpha-numeric sequences, then the whole strings are compared, so that puts 001 before 01 and 002 before 02. Only 000 and 00 stand aside, so it's a matter of consistency with other numeric values. Or think of it the other way - append something like '~' (ASCII 126) to the end of the sting, that will put 001~ before 01~ and 000~ before 00~ I try to output zeros in this case, but seems like I'm wrong please show me some example for example for this case 2 11 11 Edited by author 11.12.2007 21:50 This test is correct, and the answer should be 00 00 The test is correct, original sequences do not need to be compatible Can someone give me a little hint, please ? make 2 sequences (s1 and s2) such that s1[i]+s2[i]<>2 My solution is based on a greedy approach. Thank you both ! :-) I think that an algorithm has many special cases. Main rool:to correct firstly s2[i] from 1 to 0 in pair s1[i]=1 and s2[i]=1 diminishing B but have pair 0, 0 in older position correcting it to 0, 1 for final increasing lexiographicly of B Who can find all cases he solve the problem After getting AC i have counted 6 cases next tests correspong each of cases 4 1011 0011 1011 0100 4 1010 0111 1011 0000 4 1011 0110 1100 0000 4 1111 0101 0000 0000 4 1010 0101 1011 0000 4 1011 0100 1100 0000 Edited by author 21.02.2007 13:58 My program successfully passed all of your test cases, but I still WA3... What can it be??? You are need in additional tests Best if you will create them yourself I have only 3 cases 1) attempt to build a >b 2) attempt to build a+1 0 3) build 0 0 A + B = A XOR B iff there is no carry, or in other words A AND B = 0 So the algo is simple Find leftmost x such that p[x]=q[x]=1. if none, assume x=n+1. Find rightmost y to the left of x such that p[y]=q[y]=0. If none, output p+1, 0 (p+1 may become 0). Otherwise set q[y]=1, and q[y+1..n]=0 Edited by author 12.07.2026 04:38 This task has some problems with accurancy, but 878 is too big rating for it. Agreed. On precision - performing multiplications before division and comparing at 1e-8 works. Can anybody expalain me this problem? I think that in both samples answer is YES, because all vertices are next to refuge or to museum. At last I've solved it. what about solution: 1) for maxflow use RelabelToFront 2) WA 36 : try this test 5 3 2 2 3 1 2 3 1 2 2 3 answer: NO 3) WA 38: test 5 3 2 2 2 1 2 3 1 2 2 3 answer: NO Try test 2 27 I got also WA at #6 and made some tests on the input. It seems that the line if (N == 34 && M == 49) while (1); got TLE (6) so the test is 34 49. My answer to this test is a-niaacgvtxwdouniwkovyjlpaaaerlqkyo niaacgvtxwdouniwkovyjlpaaaerlqkyp-aaarepihxnlfzhjsqrzpokzcbpyfypjwat aaarepihxnlfzhjsqrzpokzcbpyfypjwau-aqaaaaaaaaiiovpgvvmsnhsbbrtjgmuqbw aqaaaaaaaaiiovpgvvmsnhsbbrtjgmuqbx-bejdhnxluhaaainzrkuauccrqbastmtecb bejdhnxluhaaainzrkuauccrqbastmtecc-bssejrqozpnkflharcuholuvjdvwynyaaa bssejrqozpnkflharcuholuvjdvwynyaaa-chbflvjseyarrdiqpnyomjekfzqbtgnktz chbflvjseyarrdiqpnyomjekfzqbtgnkua-cvkgnzcvkgnzcvkgnzcvkgnzcvkgnzcvkm cvkgnzcvkgnzcvkgnzcvkgnzcvkgnzcvkn-djthqcvyppbgonlwmkhcidxnzrelirsgaz djthqcvyppbgonlwmkhcidxnzrelirsgba-dycisgpbuxooafnmkvljgbhcwmyqdkhqrm dycisgpbuxooafnmkvljgbhcwmyqdkhqrn-emljukifaapbxjvblttjroekmwfuxvlxyx emljukifaapbxjvblttjroekmwfuxvlxyy-faukwobifopcxpqshrtxbwaaaxbkkpmjnr faukwobifopcxpqshrtxbwaaaxbkkpmjns-fpdlyrulkxckjhsigcydztjvnaayrhdnnv fpdlyrulkxckjhsigcydztjvnaayrhdnnw-gdmnachtlazghlttujryytfbucbeeqsbil gdmnachtlazghlttujryytfbucbeeqsbim-grvoczgrvoczgrvoczgrvoczgrvoczgrvv grvoczgrvoczgrvoczgrvoczgrvoczgrvw-hgepfczvawqgsjxebkkytlmodnpsxrwcmh hgepfczvawqgsjxebkkytlmodnpsxrwcmi-hunqhgsygfdoebytzvpfriwdajjxsklnct hunqhgsygfdoebytzvpfriwdajjxsklncu-iiwrjkmblnqvpuajygtmpgfrxfecndaxtf iiwrjkmblnqvpuajygtmpgfrxfecndaxtg-ixfslofeqwedbmbzwrxtndpguayhhvqijr ixfslofeqwedbmbzwrxtndpguayhhvqijs-jlotnryhwerknedpvdcalayvqwsmcoftaa jlotnryhwerknedpvdcalayvqwsmcoftaa-jzxupvrlbnerywfftoghiyiknsmqxgvdqp jzxupvrlbnerywfftoghiyiknsmqxgvdqq-kogvrzkogvrzkogvrzkogvrzkogvrzkohb kogvrzkogvrzkogvrzkogvrzkogvrzkohc-lcpwuddrmefgwgilqkovetbohkbamrzyxn lcpwuddrmefgwgilqkovetbohkbamrzyxo-lqyxwgwurmsohykbovtccqldefvfhkpjnz lqyxwgwurmsohykbovtccqldefvfhkpjoa-mfhyykpxwvfvtqlrngxjanusbbpkcdeuel mfhyykpxwvfvtqlrngxjanusbbpkcdeuem-mtraaaaaaadyagcaylnbwefjfiwhlkxzyt mtraaaaaaadyagcaylnbwefjfiwhlkxzyu-niaaaaaamqmtnchcwhigpdmsazucrszvdb niaaaaaamqmtnchcwhigpdmsazucrszvdc-nwjcevvhmutscsqniokdufxkroxymgzaaa nwjcevvhmutscsqniokdufxkroxymgzaaa-oksdgzoksdgzoksdgzoksdgzoksdgzoksh oksdgzoksdgzoksdgzoksdgzoksdgzoksi-ozbejdhnxluhaabhlcxuvdfatyrziklvtv ozbejdhnxluhaabhlcxuvdfatyrziklvtw-pnkflharcuholuvjdvwynyaabjmfvzjyxn pnkflharcuholuvjdvwynyaabjmfvzjyxo-qbtgnktuicuvxmwzchbflvjseyarrdiqpr qbtgnktuicuvxmwzchbflvjseyarrdiqps-qqchpomxnlidjeypacedivahvrcqaaaaaa qqchpomxnlidjeypacedivahvrcqaaaaaa-relirsgastvkuxaezdjthqcvyppbgonlwp relirsgastvkuxaezdjthqcvyppbgonlwq-rsujtvzdycisgpbuxooafnmkvljgbhcwnb rsujtvzdycisgpbuxooafnmkvljgbhcwnc-shdkvzshdkvzshdkvzshdkvzshdkvzshdn shdkvzshdkvzshdkvzshdkvzshdkvzshdo-svmlydlkitjhdzfaukwobifopcxpqshrtz svmlydlkitjhdzfaukwobifopcxpqshrua-tjvnacjothflsugpqhyezmsbiabaabensx tjvnacjothflsugpqhyezmsbiabaabensy-tyeockxqtkjwbjigrhfbxcysiulzgdmnax tyeockxqtkjwbjigrhfbxcysiulzgdmnay-umnpeoqtysxdnbjwpsjivaihfqgeawbxrj umnpeoqtysxdnbjwpsjivaihfqgeawbxrk-vawqgsjxebkkytlmodnpsxrwcmaivorihv vawqgsjxebkkytlmodnpsxrwcmaivorihw-vpfriwdajjxsklncmorwqvbkzhunqhgsyh vpfriwdajjxsklncmorwqvbkzhunqhgsyi-wdoskzwdoskzwdoskzwdoskzwdoskzwdot wdoskzwdoskzwdoskzwdoskzwdoskzwdou-wrxtndpguayhhvqijlabeukemqvwvdoaaa wrxtndpguayhhvqijlabeukemqvwvdoaaa-xgguphijzjlotnryhwerknedpvdcaaaaud xgguphijzjlotnryhwerknedpvdcaaaaue-xupvrlbnerywfftoghiyiknsmqxgvdqjmd xupvrlbnerywfftoghiyiknsmqxgvdqjme-yiywtouqkamdqxveesnfghxhjmrlpwfucp yiywtouqkamdqxveesnfghxhjmrlpwfucq-yxhxvsntpizlcpwuddrmefgwgilqkovetb yxhxvsntpizlcpwuddrmefgwgilqkovetc-zlqyxwgwurmsohykbovtccqldefvfhkpjn zlqyxwgwurmsohykbovtccqldefvfhkpjo-zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz Can anyone write the correct answer? Thank you Edited by author 19.03.2008 18:53 I don't understant what's wrong, here are the number of pieces each processor has: 34 49 27285448088939550474430463423979178157730683277 27285448088939550474430463423979178157730683277 27285448088939550474430463423979178157730683277 27285448088939550474430463423979178157730683277 27285448088939550474430463423979178157730683277 27285448088939550474430463423979178157730683277 27285448088939550474430463423979178157730683277 27285448088939550474430463423979178157730683277 27285448088939550474430463423979178157730683277 27285448088939550474430463423979178157730683277 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 27285448088939550474430463423979178157730683276 (26^34) % M = 10 so I distributed the 10 remaining strings on the first processors, according to the sample test (when the remainder was 2) Any hint? solved! 'bssejrqozpnkflharcuholuvjdvwynyaaa' on processor 5 and 6 is obviously wrong input: 34 49 output: a-niabcscehmgkraoxkdfwwinvutdtrojpm niabcscehmgkraoxkdfwwinvutdtrojpn-abrbdglfjpznwjcevvhmutscsqniokdufz abrbdglfjpznwjcevvhmutscsqniokduga-aqacfkeioymvibduugltsrbrpmhnjctewm aqacfkeioymvibduugltsrbrpmhnjctewn-bejdhnxluhacttfksrqaqolgmibsdvipmz bejdhnxluhacttfksrqaqolgmibsdvipna-bssejrqozpnkflharcuholuvjdvwynyadm bssejrqozpnkflharcuholuvjdvwynyadn-chbflvjseyarrdiqpnyomjekfzqbtgnktz chbflvjseyarrdiqpnyomjekfzqbtgnkua-cvkgnzcvkgnzcvkgnzcvkgnzcvkgnzcvkm cvkgnzcvkgnzcvkgnzcvkgnzcvkgnzcvkn-djthqcvyppbgonlwmkhcidxnzrelirsgaz djthqcvyppbgonlwmkhcidxnzrelirsgba-dycisgpbuxooafnmkvljgbhcwmyqdkhqrm dycisgpbuxooafnmkvljgbhcwmyqdkhqrn-emljukifagbvlxpcjgpqdyqrtisuycxbhz emljukifagbvlxpcjgpqdyqrtisuycxbia-faukwobifopcxpqshrtxbwagqemzsvmlyl faukwobifopcxpqshrtxbwagqemzsvmlym-fpdlyrulkxckjhsigcydztjvnahenobwox fpdlyrulkxckjhsigcydztjvnahenobwoy-gdmnavnoqfpruztyeockxqtkjwbjigrhfj gdmnavnoqfpruztyeockxqtkjwbjigrhfk-grvoczgrvoczgrvoczgrvoczgrvoczgrvv grvoczgrvoczgrvoczgrvoczgrvoczgrvw-hgepfczvawqgsjxebkkytlmodnpsxrwcmh hgepfczvawqgsjxebkkytlmodnpsxrwcmi-hunqhgsygfdoebytzvpfriwdajjxsklnct hunqhgsygfdoebytzvpfriwdajjxsklncu-iiwrjkmblnqvpuajygtmpgfrxfecndaxtf iiwrjkmblnqvpuajygtmpgfrxfecndaxtg-ixfslofeqwedbmbzwrxtndpguayhhvqijr ixfslofeqwedbmbzwrxtndpguayhhvqijs-jlotnryhwerknedpvdcalayvqwsmcoftad jlotnryhwerknedpvdcalayvqwsmcoftae-jzxupvrlbnerywfftoghiyiknsmqxgvdqp jzxupvrlbnerywfftoghiyiknsmqxgvdqq-kogvrzkogvrzkogvrzkogvrzkogvrzkohb kogvrzkogvrzkogvrzkogvrzkogvrzkohc-lcpwuddrmefgwgilqkovetbohkbamrzyxn lcpwuddrmefgwgilqkovetbohkbamrzyxo-lqyxwgwurmsohykbovtccqldefvfhkpjnz lqyxwgwurmsohykbovtccqldefvfhkpjoa-mfhyykpxwvfvtqlrngxjanusbbpkcdeuel mfhyykpxwvfvtqlrngxjanusbbpkcdeuem-mtraaojbcdtdfinhlsbpylegxxjowvueux mtraaojbcdtdfinhlsbpylegxxjowvueuy-niabcscehmgkraoxkdfwwinvutdtrojplj niabcscehmgkraoxkdfwwinvutdtrojplk-nwjcevvhmutscsqniokdufxkroxymgzabv nwjcevvhmutscsqniokdufxkroxymgzabw-oksdgzoksdgzoksdgzoksdgzoksdgzoksh oksdgzoksdgzoksdgzoksdgzoksdgzoksi-ozbejdhnxluhacttfksrqaqolgmibsdvit ozbejdhnxluhacttfksrqaqolgmibsdviu-pnkflharcuholuvjdvwynyadicgmwktfzf pnkflharcuholuvjdvwynyadicgmwktfzg-qbtgnktuicuvxmwzchbflvjseyarrdiqpr qbtgnktuicuvxmwzchbflvjseyarrdiqps-qqchpomxnlidjeypasfmjsthbtuwlvybgd qqchpomxnlidjeypasfmjsthbtuwlvybge-relirsgastvkuxaezdjthqcvyppbgonlwp relirsgastvkuxaezdjthqcvyppbgonlwq-rsujtvzdycisgpbuxooafnmkvljgbhcwnb rsujtvzdycisgpbuxooafnmkvljgbhcwnc-shdkvzshdkvzshdkvzshdkvzshdkvzshdn shdkvzshdkvzshdkvzshdkvzshdkvzshdo-svmlydlkitjhdzfaukwobifopcxpqshrtz svmlydlkitjhdzfaukwobifopcxpqshrua-tjvnahenobwoprgqswauzfpdlyrulkxckl tjvnahenobwoprgqswauzfpdlyrulkxckm-tyeockxqtkjwbjigrhfbxcysiulzgdmnax tyeockxqtkjwbjigrhfbxcysiulzgdmnay-umnpeoqtysxdnbjwpsjivaihfqgeawbxrj umnpeoqtysxdnbjwpsjivaihfqgeawbxrk-vawqgsjxebkkytlmodnpsxrwcmaivorihv vawqgsjxebkkytlmodnpsxrwcmaivorihw-vpfriwdajjxsklncmorwqvbkzhunqhgsyh vpfriwdajjxsklncmorwqvbkzhunqhgsyi-wdoskzwdoskzwdoskzwdoskzwdoskzwdot wdoskzwdoskzwdoskzwdoskzwdoskzwdou-wrxtndpguayhhvqijlakmpuoszixfsloff wrxtndpguayhhvqijlakmpuoszixfslofg-xgguphijzjlotnryhwerknedpvdcalayvr xgguphijzjlotnryhwerknedpvdcalayvs-xupvrlbnerywfftoghiyiknsmqxgvdqjmd xupvrlbnerywfftoghiyiknsmqxgvdqjme-yiywtouqkamdqxveesnfghxhjmrlpwfucp yiywtouqkamdqxveesnfghxhjmrlpwfucq-yxhxvsntpizlcpwuddrmefgwgilqkovetb yxhxvsntpizlcpwuddrmefgwgilqkovetc-zlqyxwgwurmsohykbovtccqldefvfhkpjn zlqyxwgwurmsohykbovtccqldefvfhkpjo-zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz Thanks for the test :) I solved it using base-26 long arithmetics, but forgot to prepend leading zeroes (leading 'a'), so could output "brg" instead of "aabrg" Calculate powers of 26 and prefix sums of powers of 26. Calculate ranges by integer division. Calculate each password from left to right like you would calculate k-permutation using factorial digit system. Base-26 arithmetics simplifies things a lot here :) It's not clear if black player can continue movement or not after eating white bishop. Bishop moves first, so if at first pawn can capture bishop it does not matter. On the next moves bishop can avoid such positions where pawn can capture it. Just according to problem statement it's white wins :), so looks weird Please, check 142 test, C++ fread failed for this test case. scanf accepted. After fread I can try trim space symbols (ASCII code <= 32) from start and end, any more WA142. Any hint for solving this problem? number of possible operations is only 1m > number of possible operations is only 1m Hah! Somehow reading this here (even though it's clear in the problem statement) made me see the way...thanks. memcpy (for c++) and million.., and not any more ;p Try this test: 2 abc b 1 abc Correct answer: 1 1 3 5 1 4 5 7 3 8 2 4 4 7 5 3 7 7 0 3 5 2 5 1 5 3 4 3 8 8 8 6 0 6 6 1 I got tle on these tests.But I got AC. My AC solution outputs "NO" on both of those test cases. Answer to second test is YES. And, moreover, there are 840 ways to fill the square. Upd. Sorry, forgot about constraint a[0][0]=0. (But, if ignore it, 840 is correct number.) Edited by author 09.07.2026 19:19 O(N) for RAM and CPU, don't know why memory limit is that high. Based on classics for tree diameter. Doesn't matter, could be -1000 What is the maximum number of divisions needed to get the full period? I got TLE this O(n^2) algo there n is the number of divisions. O(n*lg n) from number of divisions also TLE. But why...? O(n) AC in 0.234 O(n^2) memorization of prev remainders in vector with linear search O(n*lg n) memorization of prev remainders in set O(n) just used bitset<10000> cause all remainders is less then 10000 But why O(n*lg n) TLE!?!?!? just remember position for each remainder, once stepped over again - period detected. O(b) memory, O(b) runtime You can solve that with algo Djikstra. We have 6!*8*8 vertex (hash of cube and point) . And all vertexs have <=4 edges. P.s. sry for English ) Edited by author 09.08.2014 16:51 there are only 24 orientations just use DSU to check teams, and then build answer why dsu? just bfs on revival links. if component >4 - FAKE. then fill up 3+1, 2+2, 2+1+1, 1+1+1+1 The first day has no delay flight from the day before. 2 1 60 100 23:00 He can departure from 24:00 , not 00:00 Thanks, but with this change just for the 1st flight it gets WA13 :) The right solution is to get yesterday flights only when current time spent is >= 1440. Problem statement lacks "from this moment" phrase which exists in russian version. Edited by author 08.07.2026 23:57 O(W*H) solution passes Edited by author 22.08.2021 13:50 Edited by author 22.08.2021 13:50 I did it O(N^3) way, but can be done O(N^2*log(N)) Edited by author 08.07.2026 23:43 |
|