Submission #119911

#TimeUsernameProblemLanguageResultExecution timeMemory
119911dolphingarlicCrayfish scrivener (IOI12_scrivener)C++14
26 / 100
214 ms13944 KiB
#include <bits/stdc++.h> using namespace std; pair<char, int> v[1000005]; char s[1000005]; int indx = 0, i = 0; bool got = false; void Init() { } void TypeLetter(char L) { v[indx++] = {'T', L - 'a'}; } void UndoCommands(int U) { v[indx++] = {'U', U + 1}; } char GetLetter(int P) { if (!got) { int ptr = indx - 1; while (ptr > -1) { while (v[ptr].first == 'U') ptr -= v[ptr].second; s[i++] = (char)(v[ptr--].second + 'a'); } got = true; } return s[i - 1 - P]; } // int main() { // int t; // cin >> t; // Init(); // for (int i = 0; i < t; i++) { // char c, d; int e; // cin >> c; // switch (c) { // case 'T': // cin >> d; // TypeLetter(d); // break; // case 'P': // cin >> e; // cout << GetLetter(e) << '\n'; // break; // default: // cin >> e; // UndoCommands(e); // } // } // }
#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...