제출 #456133

#제출 시각아이디문제언어결과실행 시간메모리
456133KhizriCrayfish scrivener (IOI12_scrivener)C++17
60 / 100
1075 ms14244 KiB
#include <bits/stdc++.h>
#define pb push_back
#define F first																 
#define S second 
#define all(v) (v).begin(),(v).end()
using namespace std;
const int mxn=1e6+5;
int k=0;
vector<pair<int,int>>vt;
char last;
char alp[30];
string s;
bool y=true;
void Init() {
	char q='a';
	for(int i=0;i<26;i++){
		alp[i]=q;
		q++;
	}
}

void TypeLetter(char L) {
	y=false;
	int x=L-'a';
	vt.pb({1,x});
}

void UndoCommands(int U) {
	y=false;
	vt.pb({2,U});
}

char GetLetter(int P) {
	if(!y){
		y=true;
		s="";
		int ind=vt.size()-1;
		while(ind>=0){
			int a=vt[ind].F,b=vt[ind].S;
			if(a==1){
				s+=alp[b];
				ind--;
			}
			else{
				ind=ind-b-1;
			}
		}
		reverse(all(s));
	}
	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...