제출 #483528

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
4835282021-10-30 08:33:11dannyboy20031204크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++17
53 / 100
823 ms86680 KiB
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1;
char c[N];
int now = 0, idx = 0, d[N], anc[N][21];
void Init() {
now = idx = 0;
}
void TypeLetter(char L) {
idx++;
d[idx] = d[now] + 1;
anc[idx][0] = now;
int r = 0;
while ((1 << r) < d[idx]) r++;
for (int i = 1; i <= r; i++) anc[idx][i] = anc[anc[idx][i - 1]][i - 1];
c[idx] = L;
now = idx;
}
void UndoCommands(int U) {
idx++;
int p = idx - U - 1;
d[idx] = d[p];
anc[idx][0] = p;
int r = 0;
while ((1 << r) < d[idx]) r++;
for (int i = 1; i <= r; i++) anc[idx][i] = anc[anc[idx][i - 1]][i - 1];
now = idx;
}
char GetLetter(int P) {
P++;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...