답안 #62912

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
62912 2018-07-30T19:56:44 Z theknife2001 크레이피쉬 글쓰는 기계 (IOI12_scrivener) C++17
0 / 100
1000 ms 263168 KB
//#include <bits/stdc++.h>
//
//using namespace std;
//const int N=1e6+5;
//int a[N];
//char b[N];
//int c[N];
//char s[N];
//int cnt;
//int k=0;
//
//
//void Init() {}
//
//void TypeLetter(char L) {
//    a[k]=1;
//    b[k]=L;
//    k++;
//}
//
//void UndoCommands(int U) {
//    a[k]=2;
//    c[k]=U;
//    k++;
//}
//
//char GetLetter(int P) {
//    if(cnt==0)
//    {
//        int j=0;
//        k--;
//        while(k>=0)
//        {
//            if(a[k]==1)
//            {
//                s[j]=b[k];
//                j++;
//            }
//            else if(a[k]==2)
//            {
//                k=k-c[k];
//            }
//            else
//            {
//                cout<<k<<endl;
//                assert(0);
//            }
//            k--;
//        }
//        reverse(s,s+j);
//    }
//    cnt=1;
//    return s[P];
//}
#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++;
    letter[node]=c;
    node=trie[node][c];
    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];
    k++;
}

void UndoCommands(int U)
{
    node=a[k-U];
    l[k]=l[k-U];
    a[k]=node;
    k++;
}
char GetLetter(int P)
{
    P=l[k-1]-P;
    for(int i=21;i>=0;i--)
    {
        if(P&(1<<i))
            P=p[node][i];
    }
    return letter[P];
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 619 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 -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 618 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1065 ms 263168 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1039 ms 263168 KB Time limit exceeded
2 Halted 0 ms 0 KB -