Submission #998433

#TimeUsernameProblemLanguageResultExecution timeMemory
998433cnn008Combo (IOI18_combo)C++17
10 / 100
48 ms952 KiB
#include "bits/stdc++.h" #include "combo.h" using namespace std; string push_top(string &s, char c){ reverse(s.begin(),s.end()); s.push_back(c); reverse(s.begin(),s.end()); return s; } string pop_top(string &s){ reverse(s.begin(),s.end()); s.pop_back(); reverse(s.begin(),s.end()); return s; } string guess_sequence(int n) { char c[]={'A','B','X','Y'}; string s; while(1){ if((int)s.size()==n) break; bool f=0; for(int i=0; i<4; i++){ s.push_back(c[i]); if(press(s)==(int)s.size()){ f=1; break; }else s.pop_back(); } if(!f) break; } while(1){ if((int)s.size()==n) break; bool f=0; for(int i=0; i<4; i++){ s=push_top(s,c[i]); if(press(s)==(int)s.size()){ f=1; break; }else s=pop_top(s); } if(!f) break; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...