# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
679990 | Ahmed57 | Crayfish scrivener (IOI12_scrivener) | C++14 | 628 ms | 179232 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;
//TRIE
struct node{
node *nxt[26];
int ind;
node(){
ind = -1;
for(int i = 0;i<26;i++){
nxt[i] = NULL;
}
}
};
map<int,node*> mp;
map<int,char> ch;
node* root = new node();
int op = 0;
void Init(){
mp[op] = root;
}
void TypeLetter(char l){
if(root->nxt[l-'a']==NULL){
root->nxt[l-'a'] = new node();
}
int z = root->ind;
root = root->nxt[l-'a'];
root->ind = z+1;
ch[z+1] = l;
mp[++op] = root;
}
void UndoCommands(int u){
mp[++op] = mp[op-(u+1)];
root = mp[op];
}
char GetLetter(int p){
return ch[p];
}
/*int main(){
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
init();
TypeLetter('a');
TypeLetter('b');
cout<<GetLetter(1)<<"\n";
TypeLetter('d');
UndoCommands(2);
UndoCommands(1);
cout<<GetLetter(2)<<"\n";
}*/
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... |