제출 #94056

#제출 시각아이디문제언어결과실행 시간메모리
94056fjzzq2002크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++14
100 / 100
457 ms142420 KiB
#include <bits/stdc++.h> using namespace std; #define SZ 20005555 int an=0,ch[SZ][2]; char va[SZ]; int edt(int x,int l,int r,int p,char u) { int y=++an; if(l==r) {va[y]=u; return y;} int m=(l+r)>>1; if(p<=m) ch[y][1]=ch[x][1], ch[y][0]=edt(ch[x][0],l,m,p,u); else ch[y][0]=ch[x][0], ch[y][1]=edt(ch[x][1],m+1,r,p,u); return y; } char qry(int x,int l,int r,int p) { if(l==r) return va[x]; int m=(l+r)>>1; if(p<=m) return qry(ch[x][0],l,m,p); return qry(ch[x][1],m+1,r,p); } int rs[SZ],cu=0,ls[SZ]; void Init() {} void TypeLetter(char L) { ++cu; ls[cu]=ls[cu-1]+1; rs[cu]=edt(rs[cu-1],0,1.001e6,ls[cu-1],L); } void UndoCommands(int U) { ++cu; ls[cu]=ls[cu-U-1]; rs[cu]=rs[cu-U-1]; } char GetLetter(int P) {return qry(rs[cu],0,1.001e6,P);}
#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...