Submission #417056

#TimeUsernameProblemLanguageResultExecution timeMemory
417056Emin2004Crayfish scrivener (IOI12_scrivener)C++14
34 / 100
240 ms262148 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define pii pair<int, int> #define F first #define S second const int N = 1000005; const int mod = 1e9+7; struct P{ int type; char ch; int num; }; string s = "", res[N]; int m = 0, lastty = 0; P a[N]; string get(int idx){ if(idx < 0) return ""; if(res[idx] != "") return res[idx]; if(a[idx].type == 1){ return res[idx] = get(idx - 1) + a[idx].ch; } else return res[idx] = get(idx - 1 - a[idx].num); } void Init() {} void TypeLetter(char L) { a[m].type = 1; a[m].num = 0; a[m].ch = L; m++; lastty = 1; } void UndoCommands(int U) { a[m].type = 2; a[m].num = U; a[m].ch = '1'; m++; lastty = 2; } char GetLetter(int P) { if(lastty != 3){ s = get(m - 1); } lastty = 3; 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...