# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
124836 | nxteru | Crayfish scrivener (IOI12_scrivener) | C++14 | 468 ms | 63864 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int le[1000005],n,k,par[20][1000005],dp[1000005];
char re[1000005];
void Init(void){};
void TypeLetter(char c){
int v=le[n],x=c-'a';
k++;
re[k]=c;
par[0][k]=v;
dp[k]=dp[v]+1;
for(int i=0;i<19;i++)par[i+1][k]=par[i][par[i][k]];
n++;
le[n]=k;
}
void UndoCommands(int x){
le[n+1]=le[n-x];
n++;
}
char GetLetter(int x){
x++;
int v=le[n];
for(int i=0;i<20;i++)if((dp[v]-x)>>i&1)v=par[i][v];
return re[v];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |