제출 #1001335

#제출 시각아이디문제언어결과실행 시간메모리
1001335ZeroCool크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++14
100 / 100
507 ms86608 KiB
#include <bits/stdc++.h> using namespace std; void Init() {} const int N = 1e6 + 20, LOG = 20; int n; int up[N][LOG], dep[N]; char A[N]; void TypeLetter(char c) { ++n; A[n] = c; up[n][0] = n - 1; dep[n] = dep[n-1] + 1; for(int i = 1;i < LOG;i++)up[n][i] = up[up[n][i-1]][i-1]; } void UndoCommands(int x) { ++n; up[n][0] = n - x - 1; dep[n] = dep[n - x - 1]; for(int i = 1;i < LOG;i++)up[n][i] = up[up[n][i-1]][i-1]; } char GetLetter(int x) { ++x; int u = n; for(int i = LOG - 1;i >= 0;i--){ if(dep[up[u][i]] >= x){ u = up[u][i]; } } return A[u]; }
#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...