제출 #61824

#제출 시각아이디문제언어결과실행 시간메모리
61824theknife2001크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++17
0 / 100
269 ms3184 KiB
#include <bits/stdc++.h>
#define ii pair < char , char >
#define fi first
#define se second


using namespace std;
const int N=1e6+5;
ii a[N];
char s[N];
bool q=0;
int k=0;


void Init() {}

void TypeLetter(char L) {
    a[k].fi='T';
    a[k].se=L;
    k++;
}

void UndoCommands(int U) {
    a[k].fi='F';
    a[k].se='0'+U;
    k++;
}

int j=0;

char GetLetter(int P) {
    if(!q)
    {
        j=0;
        k--;
        while(k>=0)
        {
            if(a[k].fi=='T')
            {
                s[j]=a[k].se;
                j++;
            }
            else if(a[k].fi=='F')
            {
                k-=(a[k].se-'0');
            }
            k--;
        }
        reverse(s,s+j);
    }
    q=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...