Submission #357166

#TimeUsernameProblemLanguageResultExecution timeMemory
357166daniel920712Crayfish scrivener (IOI12_scrivener)C++14
60 / 100
256 ms14416 KiB
#include <stack> #include <vector> using namespace std; char last; int con[1000005]={0}; int now=0; int how=0; int ok=0; stack < char > ans; vector < char > tt; vector < pair < int , int > > all; void Init() { } void TypeLetter(char L) { all.push_back(make_pair(1,L)); now++; } void UndoCommands(int U) { all.push_back(make_pair(2,U)); now++; } char GetLetter(int P) { int t,i; if(now<=5000||ok==0) { ok=1; how=0; tt.clear(); for(i=now-1;i>=0;i--) { if(how) { how--; continue; } if(all[i].first==1) ans.push(all[i].second); else how+=all[i].second; } while(!ans.empty()) { tt.push_back(ans.top()); ans.pop(); } } return tt[P]; }

Compilation message (stderr)

scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:31:9: warning: unused variable 't' [-Wunused-variable]
   31 |     int t,i;
      |         ^
#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...