# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31197 | pasa3232 | Crayfish scrivener (IOI12_scrivener) | C++14 | 699 ms | 128132 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 now, A[1000010], d[30][1000010], lev[1000010];
char L[1000010];
char last;
void Init() {
for(int i=0; i<30; i++) for(int j=0; j<1000010; j++) d[i][j]=-1;
}
void TypeLetter(char La) {
A[++now]=now;
lev[now]=lev[A[now-1]]+1;
L[now]=La;
d[0][now]=A[now-1];
for(int i=1; d[i-1][d[i-1][now]]!=-1; i++) d[i][now]=d[i-1][d[i-1][now]];
}
void UndoCommands(int U) {
A[++now]=A[now-U-1];
}
char GetLetter(int P) {
int b=P;
b=lev[A[now]]-b-1;
int rev=A[now];
while(b){
int i, num;
for(i=0, num=1; num<=b; i++, num*=2);
i--;
b-=(num/2);
rev=d[i][rev];
}
return L[rev];
}
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... |