Test case 1 understanding is correct and it gives success response. That is why I think it was for 1pt only.
On Tue, Apr 7, 2020 at 8:55 AM Gürel Yıldız <[email protected]> wrote: > Hi, > > May be I understand the question wrongly. So may I ask that > > If at my first query, one of the four possible quantum fluctuation effects > would be applied, how can I use the result of first ten query as a result? > Because at my first query, predetermined array should have been changed. > Test Set 1 > > In Test Set 1, there are only 10 positions in the string. We can query for > each of them and then submit the complete string, without having to worry > about any quantum fluctuations (which would only happen if we submitted an > 11th query). > > t, b = readline_int_list() // reads 100 into t and 10 into b. > // The judge starts with the predetermined array for this test case: > // 0001101111. (Note: the actual Test Set 1 will not necessarily > // use this array.) > printline 1 to stdout // we ask about position 1. > flush stdout > // Since this is our 1st query, and 1 is 1 mod 10, the judge secretly and > // randomly chooses one of the four possible quantum fluctuation effects, as > // described above. It happens to choose complementation + reversal, so now > // the stored value is 0000100111. > r = readline_chr() // reads 0. > printline 6 to stdout // we ask about position 6. > flush stdout > > > Thank you very much. > > > On Tuesday, April 7, 2020 at 4:05:10 AM UTC+3, Mykhailo Bichurin wrote: >> >> Could anyone tell me please what could cause TLE error in "ESAb ATAd" >> problem? If we talk about regular problem of having a slow algorithm, this >> couldn't be the thing because my program takes *O(T * B)* which is >> *O(10^4)* on the hidden test set. Though the code doesn't pass neither >> Visible test set 1 nor the testing tool. >> It works just fine on my computer so it makes me think the problem is >> with output buffer. But there is "*fflush(stdout);*" line after each " >> *prinf*" so I don't really understand what's the deal. >> Also I used "*prinf/scanf*" to work faster with *I/O* but I also sent >> the same code with "cin/cout" and it didn't pass the tests too. >> >> Here's my code: >> #include <stdio.h> >> int main() { >> short int T, B; >> char s[101], verd = 'Y'; >> scanf("%hi%hi", &T, &B); >> for (short int t = 1; t <= T && verd == 'Y'; t++) { >> scanf("\n%s", s); >> bool comBoth_same = 0, comRev_dif = 0; >> short int iDif = -1, iSame = -1, >> aDif, aSame; >> for (short int i = 0; (i < (B >> 1)) && (iDif == -1 || iSame == >> -1); i++) { >> if (s[i] == s[B - 1 - i] && iSame == -1) iSame = i; >> if (s[i] != s[B - 1 - i] && iDif == -1) iDif = i; >> } >> if (iSame != -1) { >> printf("%hi\n", 1 + iSame); >> fflush(stdout); >> scanf("%hi", &aSame); >> comBoth_same = (aSame != s[iSame] - '0'); >> } >> if (iDif != -1) { >> printf("%hi\n", 1 + iDif); >> fflush(stdout); >> scanf("%hi", &aDif); >> comRev_dif = (aDif != s[iDif] - '0'); >> } >> >> if (comBoth_same && comRev_dif) { >> for (short int i = 0; i < B; i++) { >> printf(s[i] == '1' ? "0" : "1"); >> } >> printf("\n"); >> fflush(stdout); >> } >> else if (comBoth_same && !comRev_dif) { >> for (short int i = B - 1; i >= 0; i--) { >> printf(s[i] == '1' ? "0" : "1"); >> } >> printf("\n"); >> fflush(stdout); >> } >> else if (!comBoth_same && comRev_dif) { >> for (short int i = B - 1; i >= 0; i--) { >> printf("%c", s[i]); >> } >> printf("\n"); >> fflush(stdout); >> } >> else { >> printf("%s", s); >> printf("\n"); >> fflush(stdout); >> } >> scanf("\n%c", &verd); >> } >> return 0; >> } >> >> Thanks in advance! >> > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-code/fa138c7a-aebe-49d4-8e39-38da405f3022%40googlegroups.com > <https://groups.google.com/d/msgid/google-code/fa138c7a-aebe-49d4-8e39-38da405f3022%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Cheers! Aabhas -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/CAFjJqoe7oX6hHX3_T5BVnm2-WLiGJG-d6RR4TdVGbm2_Ufwg7w%40mail.gmail.com.
