Submission #425796

#TimeUsernameProblemLanguageResultExecution timeMemory
425796AzimjonCrayfish scrivener (IOI12_scrivener)C++17
34 / 100
1094 ms6476 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1111111; int p[N], v[N]; int cnt = 0; void Init() { p[0] = -1; v[0] = '-'; } void TypeLetter(char L) { int id = ++cnt; p[id] = cnt - 1; v[id] = L; } void UndoCommands(int U) { int par = cnt; int t = U; while (t--) { par--; } int id = ++cnt; p[id] = par; v[id] = '-'; // for (int i = 0; i <= 20; i++) { // cout << p[i] << " "; // } // cout << endl; // for (int i = 0; i <= 20; i++) { // cout << (char)v[i] << " "; // } // cout << endl; } char GetLetter(int P) { string s; int pr = cnt; while (pr != -1) { if (v[pr] != '-') s.push_back(v[pr]); pr = p[pr]; } reverse(s.begin(), s.end()); // cout << "s=" << s << " " << s.size() << endl; 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...