제출 #169303

#제출 시각아이디문제언어결과실행 시간메모리
169303AlexLuchianov크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++98
34 / 100
1077 ms79712 KiB
int const nmax = 1000000; char last; int far[1 + nmax][20], ptr = 0; int level[1 + nmax]; char chr[1 + nmax]; void Init() {} void TypeLetter(char L) { ++ptr; far[ptr][0] = ptr - 1; for(int h = 1; h < 20; h++) far[ptr][h] = far[far[ptr][h - 1]][h - 1]; level[ptr] = level[far[ptr][0]] + 1; chr[ptr] = L; } void UndoCommands(int U) { ++ptr; far[ptr][0] = ptr - 1 - U; for(int h = 1; h < 20; h++) far[ptr][h] = far[far[ptr][h - 1]][h - 1]; level[ptr] = level[far[ptr][0]]; } char GetLetter(int P) { int pos = ptr; P++; for(int h = 19; 0 <= h; h--) if(P <= level[far[pos][h]] ) pos = far[pos][h]; 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...