답안 #62916

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
62916 2018-07-30T20:17:39 Z theknife2001 크레이피쉬 글쓰는 기계 (IOI12_scrivener) C++17
34 / 100
1000 ms 263168 KB
#include <bits/stdc++.h>


using namespace std;
const int N=1e6+55;
int trie[N*2][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);
}

int c,temp,nd;
void TypeLetter(char L)
{
    c=L-'a';
    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;
    nd=node;
    for(int i=21;i>=0;i--)
    {
        if(P&(1<<i))
            nd=p[nd][i];
    }
    return letter[nd];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 179 ms 204016 KB Output is correct
2 Correct 202 ms 204016 KB Output is correct
3 Correct 164 ms 204016 KB Output is correct
4 Correct 167 ms 204016 KB Output is correct
5 Correct 168 ms 204016 KB Output is correct
6 Correct 168 ms 204028 KB Output is correct
7 Correct 181 ms 204060 KB Output is correct
8 Correct 179 ms 204092 KB Output is correct
9 Correct 169 ms 204180 KB Output is correct
10 Correct 167 ms 204180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 164 ms 204180 KB Output is correct
2 Correct 166 ms 204180 KB Output is correct
3 Correct 171 ms 204248 KB Output is correct
4 Correct 158 ms 204248 KB Output is correct
5 Correct 170 ms 204248 KB Output is correct
6 Correct 177 ms 204268 KB Output is correct
7 Correct 188 ms 204304 KB Output is correct
8 Correct 186 ms 204304 KB Output is correct
9 Correct 170 ms 204304 KB Output is correct
10 Correct 184 ms 204304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 159 ms 204484 KB Output is correct
2 Correct 153 ms 204484 KB Output is correct
3 Correct 154 ms 204484 KB Output is correct
4 Correct 157 ms 204708 KB Output is correct
5 Correct 172 ms 204708 KB Output is correct
6 Correct 181 ms 204724 KB Output is correct
7 Correct 152 ms 204724 KB Output is correct
8 Correct 180 ms 204724 KB Output is correct
9 Correct 167 ms 204756 KB Output is correct
10 Correct 171 ms 204756 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 896 ms 261244 KB Output is correct
2 Execution timed out 1006 ms 263168 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1022 ms 263168 KB Time limit exceeded
2 Halted 0 ms 0 KB -