Submission #1005251

#TimeUsernameProblemLanguageResultExecution timeMemory
1005251pawnedCrayfish scrivener (IOI12_scrivener)C++17
12 / 100
88 ms10508 KiB
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")

#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;

const int MAX = 5005;

int moves = 1;
vi cuts;	// position to start adding letters

string curr;

void Init() {
	cuts.pb(0);
}

void print() {
	cout<<"cuts: ";
	for (int x : cuts)
		cout<<x<<" ";
	cout<<endl;
	cout<<"curr: "<<curr<<endl;
}

void TypeLetter(char L) {
	if ((int)(curr.size()) == cuts.back())
		curr += L;
	else
		curr[cuts.back()] = L;
	cuts.pb(cuts.back() + 1);
//	print();
	moves++;
}

void UndoCommands(int U) {
	cuts.pb(cuts[moves - U - 1]);
//	print();
	moves++;
}

char GetLetter(int P) {
	return curr[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...