# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
130264 | khulegub | Crayfish scrivener (IOI12_scrivener) | C++14 | 638 ms | 73052 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>
#define pb push_back
#define xx first
#define yy second
#define mp make_pair
using namespace std;
/*
IM RETARDED, JUST SO YOU KNOW LOL.
*/
/*
#############################################
# x X x _ P u $ $ y S l a y e r 6 9 _ x X x #
#############################################
*/
/*
Check array size
Check IO
*/
int sz;
int curr;
vector<pair<char, int> > s; //storing chars and ranks
int node_par[1000005][20]; //nodes parents
int par[1000005]; //cmds parents
vector<int> pos; //storing each cmd's position in "s"
void Init() {
s.pb(mp('#', 0));
sz = 0;
curr = 0; //current cmd is 0
pos.pb(0); //cmd 0 s position of node is 0
node_par[0][0] = 0;
par[0] = 0;
}
void TypeLetter(char L) {
s.pb(mp(L, s[ pos[curr] ].yy + 1)); //typing letter means new node
sz++;
node_par[sz][0] = pos[curr];
for (int i = 1; i <= 20; i++){
node_par[sz][i] = node_par[ node_par[sz][i - 1] ][i - 1];
}
pos.pb(sz);
par[++curr] = curr;
}
void UndoCommands(int U) {
pos.pb(pos[curr - U]);
par[++curr] = curr - U;
}
char GetLetter(int P) {
P++;
int tmp = pos[curr];
int j = s[tmp].yy - P;
for (int i = 0; i <= 20; i++ ){
if ( (j & (1 << i))){
tmp = node_par[tmp][i];
}
}
return s[tmp].xx;
}
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... |