Submission #425816

#TimeUsernameProblemLanguageResultExecution timeMemory
425816AzimjonCrayfish scrivener (IOI12_scrivener)C++17
0 / 100
170 ms9212 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1111111; int p[N], v[N], s[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; s[id] = s[id - 1] + 1; } void UndoCommands(int U) { int par = cnt; int t = U; while (t--) { par--; } int id = ++cnt; p[id] = par; v[id] = '-'; s[id] = s[par]; // 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; } string ss; bool flag = true; void solve() { int pr = cnt; while (pr != -1) { if (v[pr] != '-') ss.push_back(v[pr]); pr = p[pr]; } reverse(ss.begin(), ss.end()); } char GetLetter(int P) { if (flag) solve(), flag = false; 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...