Submission #114814

# Submission time Handle Problem Language Result Execution time Memory
114814 2019-06-03T04:34:36 Z Shafin666 Crayfish scrivener (IOI12_scrivener) C++14
0 / 100
35 ms 10104 KB
#include <iostream>

const int maxn = 1e5+10;
int state[maxn], parent[maxn][25];
int depth[maxn]; char letter[maxn];
int stat = 0, command = 0;

void Init() {}

void TypeLetter(char L) {
    stat++, command++;
    state[command] = stat;
    letter[stat] = L;

    int par = state[command - 1];
    depth[stat] = depth[par] + 1;
    parent[stat][0] = par;
    letter[stat] = L;

    for(int i = 0; i <= 19; i++)
        parent[stat][i] = parent[parent[stat][i-1]][i-1];
}

void UndoCommands(int U) {
    command++;
    state[command] = state[command - U - 1];
}

char GetLetter(int P) {
    int cur = state[command];
    P = depth[cur] - P - 1;

    for(int i = 0; i <= 19; i++)
        if(P & (1 << i))
            cur = parent[cur][i];

    return letter[cur];
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 26 ms 10104 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 35 ms 9720 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -