# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
437131 | aymane7 | Crayfish scrivener (IOI12_scrivener) | C++17 | 984 ms | 130116 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;
const int N=1e6+1;
vector<vector<int>> parent(N,vector<int>(21,0));
vector<char> letter(N);
vector<int> depth(N,0);
int cur=0;
void Init(){
letter[0]='.';
}
void TypeLetter(char c){
cur++;
depth[cur]=depth[cur-1]+1;
parent[cur][0]=cur-1;
letter[cur]=c;
for(int i=1;i<21;i++)
parent[cur][i]=parent[parent[cur][i-1]][i-1];
}
void UndoCommands(int u){
int nw=cur+1;
depth[nw]=depth[cur-u];
letter[nw]=letter[cur-u];
for(int i=0;i<21;i++)
parent[nw][i]=parent[cur-u][i];
cur++;
}
char GetLetter(int pos){
pos++;
//find kth parent of cur st k=depth[cur]-pos
int k=depth[cur]-pos;
# | 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... |