# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1216290 | moondarkside | Crayfish scrivener (IOI12_scrivener) | C++20 | 0 ms | 0 KiB |
std::vector<int> Instructions;
std::vector<char> TiR;
void Init(){
return;
}
void TypeLetter(char L){
Instructions.push_back(L);
}
void UndoCommands(int U){
Instructions.push_back(-U);
}
char GetLetter(int P){
if(TiR.size()==0){
for(int i=Instructions.size()-1;i>-1;i--){
if(Instructions[i]<0){
i+=Instructions[i];
}
else{
TiR.push_back((char)Instructions[i]);
}
}
}
return TiR[TiR.size()-P-1];
}