제출 #1357541

#제출 시각아이디문제언어결과실행 시간메모리
1357541maya_s크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++20
0 / 100
677 ms327680 KiB
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef pair<ll, char> plc;

vector<plc> v;
bool GotLetters = 0;
string s = "";

void Init() {

}

void TypeLetter(char L) {
  v.push_back({v.size()-1, L});
}

void UndoCommands(int U) {
  ll idx = v.size() - U - 1;
  v.push_back(v[idx]);
}

char GetLetter(int P) {
  if(!GotLetters){
    GotLetters = 1;
    ll idx = v.size()-1;
    while(1){
      auto[prev, c] = v[idx];
      s += c;
      idx = P;
      if(idx == -1) break;
    }
  }
  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...