Submission #169310

#TimeUsernameProblemLanguageResultExecution timeMemory
169310AlexLuchianovCrayfish scrivener (IOI12_scrivener)C11
34 / 100
1051 ms79352 KiB
//int const nmax = 1000000; int far[20][1 + 1000000], ptr = 0; int level[1 + 1000000]; char chr[1 + 1000000]; void Init() {} void TypeLetter(char L) { ++ptr; far[0][ptr] = ptr - 1; for(int h = 1; h < 20; h++) far[h][ptr] = far[h - 1][far[h - 1][ptr]]; level[ptr] = level[far[0][ptr]] + 1; chr[ptr] = L; } void UndoCommands(int U) { ++ptr; far[0][ptr] = ptr - 1 - U; for(int h = 1; h < 20; h++) far[h][ptr] = far[h - 1][far[h - 1][ptr]]; level[ptr] = level[far[0][ptr]]; } char GetLetter(int P) { int pos = ptr; P++; for(int h = 19; 0 <= h; h--) if(P <= level[far[h][pos]] ) pos = far[h][pos]; return chr[pos]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...