# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
70921 | FLDutchman | Crayfish scrivener (IOI12_scrivener) | C++14 | 208 ms | 68144 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;
#define pb push_back
#define fast_io() ios::sync_with_stdio(false)
#define FOR(i, l, r) for(int i = (l); i < (r); i++)
struct llist{
vector<llist*> lift;
char c;
int sz = 1;
llist (char c) : c(c){}
};
int getsz(llist *l) {
if(!l) return 0;
return l->sz;
}
llist *insert(llist* l, char c){
llist *nl = new llist(c);
nl->sz = getsz(l)+1;
if(!l) return nl;
int i = 0;
while(l->lift.size() > i){
nl->lift.pb(l);
l = l->lift[i++];
}
return nl;
}
char getletter(llist *l, int i){
FOR(k, 0, 21) if(i & (1<<k)) l = l->lift[k];
return l->c;
}
vector <llist*> v;
void Init() {
v.pb(0);
}
void TypeLetter(char L) {
v.pb(insert(v.back(), L));
}
void UndoCommands(int U) {
v.pb(v[v.size()-1-U]);
}
char GetLetter(int P) {
auto l = v.back();
return getletter(l, getsz(l)-1 - P);
}
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... |