int ops[105], prev[105][20], size[105], sz;
void Init(){
}
void TypeLetter(char L){
ops[sz] = L;
if(sz) prev[sz][0] = sz-1;
for (int i=1; i<20; i++) {
prev[sz][i] = prev[prev[sz][i-1]][i-1];
}
size[sz] = size[prev[sz][0]]+1;
sz++;
}
void UndoCommands(int U){
prev[sz][0] = sz-U-1;
for (int i=1; i<20; i++) {
prev[sz][i] = prev[prev[sz][i-1]][i-1];
}
size[sz] = size[prev[sz][0]];
sz++;
}
char GetLetter(int P){
int pos = sz-1;
int obj = P+1;
for (int i=19; i>=0; i--) {
if(size[prev[pos][i]] >= obj){
pos = prev[pos][i];
}
}
return ops[pos];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1088 KB |
Output is correct |
2 |
Correct |
0 ms |
1088 KB |
Output is correct |
3 |
Correct |
0 ms |
1088 KB |
Output is correct |
4 |
Correct |
0 ms |
1088 KB |
Output is correct |
5 |
Correct |
0 ms |
1088 KB |
Output is correct |
6 |
Correct |
0 ms |
1088 KB |
Output is correct |
7 |
Correct |
0 ms |
1088 KB |
Output is correct |
8 |
Correct |
0 ms |
1088 KB |
Output is correct |
9 |
Correct |
0 ms |
1088 KB |
Output is correct |
10 |
Correct |
0 ms |
1088 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1088 KB |
Output is correct |
2 |
Correct |
0 ms |
1088 KB |
Output is correct |
3 |
Correct |
0 ms |
1088 KB |
Output is correct |
4 |
Correct |
0 ms |
1088 KB |
Output is correct |
5 |
Correct |
0 ms |
1088 KB |
Output is correct |
6 |
Correct |
0 ms |
1088 KB |
Output is correct |
7 |
Correct |
0 ms |
1088 KB |
Output is correct |
8 |
Correct |
0 ms |
1088 KB |
Output is correct |
9 |
Correct |
0 ms |
1088 KB |
Output is correct |
10 |
Correct |
0 ms |
1088 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
1088 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
1088 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
2 |
Halted |
0 ms |
0 KB |
- |