Submission #285259

#TimeUsernameProblemLanguageResultExecution timeMemory
285259TMJNCrayfish scrivener (IOI12_scrivener)C++17
0 / 100
516 ms69240 KiB
int dp[1000000][21]; int len[1000000]; char c[1000000]; int t[1000000]; int cnt; void Init() { } void TypeLetter(char L) { cnt++; len[cnt]=len[cnt-1]+1; t[cnt]=cnt; c[cnt]=L; dp[cnt][0]=t[cnt-1]; for(int i=0;i<19;i++){ dp[cnt][i+1]=dp[dp[cnt][i]][i]; } } void UndoCommands(int U) { cnt++; len[cnt]=len[cnt-U-1]; t[cnt]=t[cnt-U-1]; for(int i=0;i<19;i++){ dp[cnt][i+1]=dp[dp[cnt][i]][i]; } } char GetLetter(int P) { P++; int p=t[cnt]; int l=len[p]; for(int i=20;i>=0;i--){ if(l-(1<<i)>=P){ p=dp[p][i]; } } return c[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...