제출 #1232989

#제출 시각아이디문제언어결과실행 시간메모리
1232989yixuan19크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++20
0 / 100
61 ms4540 KiB
#include <iostream>
#include <vector>

using namespace std;

vector<int> commands;
void Init() {
 //cout<<"init done"<<endl;
}


void TypeLetter(char L) {
  commands.push_back(int(L));
  //cout<<"letter added"<<endl;
}

void UndoCommands(int U) {
  commands.push_back(-U);
  //cout<<U<<" commands undone"<<endl;
}

bool first = true;
vector<char>text;
char GetLetter(int P) {
  if (first){
    // for (int i: commands){
    //   cout<<i<<' ';
    // }
    // cout<<endl;
    first = false;
    int i = commands.size()-1;
    while (i > 0){
      if (commands[i] < 0){
        for (int j = 0; j <= -commands[i]; ++j){
          commands.pop_back();
        }
        i = commands.size()-1;
      }else{
        i--;
      }
    }
    // for (int i: commands){
    //   cout<<i<<' ';
    // }
    // cout<<endl;
    for (int i: commands){
      text.push_back((char)i);
    }
  }
  return text[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...