제출 #61834

#제출 시각아이디문제언어결과실행 시간메모리
61834theknife2001Crayfish scrivener (IOI12_scrivener)C++17
0 / 100
127 ms13188 KiB
#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=-1;


void Init() {}

void TypeLetter(char L) {
    k++;
    a[k]=1;
    b[k]=L;
}

void UndoCommands(int U) {
    k++;
    a[k]=2;
    c[k]=U;
}

char GetLetter(int P) {
    if(cnt==0)
    {
        int j=0;
        while(k>=0)
        {
            if(a[k]==1)
            {
                s[j]=b[k];
                j++;
            }
            if(a[k]==2)
            {
                k=k-c[k];
            }
            else
            {
                cout<<k<<endl;
                assert(0);
            }
            k--;
        }
        reverse(s,s+j);
    }
    cnt=1;
    return s[P];
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...