제출 #1232960

#제출 시각아이디문제언어결과실행 시간메모리
1232960clemmy14크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++20
34 / 100
1095 ms1304 KiB
#include<bits/stdc++.h>
using namespace std;

string ans, texts;
vector<int> parent;

void Init() {

}

void TypeLetter(char L) {
	texts.push_back(L);
	ans.push_back(L);
	// if(texts.size() == 0) {
	// 	string prev; prev.push_back(L);
	// 	texts.push_back(L);
	// } else {
	// 	string prev=texts[texts.size()-1]; prev.push_back(L);
	// 	texts.push_back(prev);
	// }
	parent.push_back(parent.size()-1);
}

void UndoCommands(int U) {
	texts.push_back(' ');
	parent.push_back(parent.size()-U-1);
	// string prev=texts[texts.size()-U-1];
	// texts.push_back(prev);



	ans.clear();
	int id=texts.size()-1;
	while(id != -1) {
		if(texts[id] != ' ') ans.push_back(texts[id]);
		id=parent[id];
	}
	reverse(ans.begin(), ans.end());
}

char GetLetter(int P) {
	// cout << ans << endl;
	// cout << texts << endl;
	// for(auto x : parent) cout << x << ' ';
	// cout << endl;
	//return texts[texts.size()-1][P];
	return ans[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...