제출 #1009425

#제출 시각아이디문제언어결과실행 시간메모리
1009425SulA크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++17
0 / 100
299 ms61012 KiB
#include <iostream> #include <vector> #include <string> using namespace std; const int MAXN = 1e6; int t[MAXN+1][20], len[MAXN+1]; int pos = 0; char letter[MAXN+1]; void Init() {} void TypeLetter(char L) { letter[++pos] = L; len[pos] = len[pos-1] + 1; t[pos][0] = pos - 1; for (int b = 1; b < 20; b++) { t[pos][b] = t[t[pos][b-1]][b-1]; } } void UndoCommands(int U) { letter[++pos] = ' '; len[pos] = len[pos - U - 1]; t[pos][0] = pos - U - 1; for (int b = 1; b < 20; b++) { t[pos][b] = t[t[pos][b-1]][b-1]; } } char GetLetter(int P) { int cur = pos; P++; for (int b = 20; b > 0; b--) { if (len[t[cur][b]] >= P) { cur = t[cur][b]; } } return letter[cur]; } void OutputLogs() {}
#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...