Submission #62914

# Submission time Handle Problem Language Result Execution time Memory
62914 2018-07-30T20:15:59 Z theknife2001 Crayfish scrivener (IOI12_scrivener) C++17
0 / 100
1000 ms 263168 KB
#include <bits/stdc++.h>


using namespace std;
const int N=1e6+55;
int trie[N*4][26];
char letter[N];
int p[N][22];
int a[N];
int l[N];
int node;
int cnt=1;
int k;

void Init()
{
    node=cnt++;
    memset(trie,-1,sizeof trie);
}


void TypeLetter(char L)
{
    int c=L-'a';
    int temp=node;
    if(trie[node][c]==-1)
        trie[node][c]=cnt++;
    node=trie[node][c];
    letter[node]=L;
    a[k]=node;
    l[k]=l[k-1]+1;
    p[node][0]=temp;
    for(int i=1;i<=21;i++)
        p[node][i]=p[p[node][i-1]][i-1];
//    cout<<node<<' '<<l[k]<<' '<<L<<endl;
    k++;
}

void UndoCommands(int U)
{
    node=a[k-U-1];
    l[k]=l[k-U-1];
    a[k]=node;
//    cout<<a[k]<<' '<<l[k]<<endl;
    k++;
}
char GetLetter(int P)
{
    P=l[k-1]-P-1;
//    cout<<P<<endl;
    int nd=node;
    for(int i=21;i>=0;i--)
    {
        if(P&(1<<i))
            nd=p[nd][i];
    }
    return letter[nd];
}
# Verdict Execution time Memory Grader output
1 Runtime error 529 ms 263168 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 506 ms 263168 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 561 ms 263168 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1061 ms 263168 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1038 ms 263168 KB Time limit exceeded
2 Halted 0 ms 0 KB -