Submission #194175

#TimeUsernameProblemLanguageResultExecution timeMemory
194175oscarsierra12Crayfish scrivener (IOI12_scrivener)C++14
5 / 100
171 ms8164 KiB
#include <bits/stdc++.h> using namespace std ; const int N = 1e6+2 ; int last, delCommands; string let ; string ot ; int q ; int acc[N] ; vector <int> estavaina ; int lst; void Init() {q = 0 ;last = 0;lst = 0;} void TypeLetter(char L) { ot.push_back ( L ); ++q ; estavaina.push_back ( q ) ; } void UndoCommands(int U) { ++q ; last = q ; delCommands = U+1; // cout << last << ' ' << delCommands << '\n' ; reverse ( ot.begin(), ot.end() ) ; reverse ( estavaina.begin(), estavaina.end() ) ; while ( ot.size() ) { let.push_back ( ot.back() ) ; ot.pop_back() ; acc[estavaina.back()] ++ ; acc[estavaina.back()] += acc[lst] ; lst = estavaina.back() ; estavaina.pop_back() ; } } char GetLetter(int P) { // cout << last << ' ' << delCommands << ' ' << acc[3] << '\n' ; if ( P+1 > acc[last-delCommands] ) { P -= acc[last-delCommands] ; return ot[P] ; } return let[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...