Submission #999518

#TimeUsernameProblemLanguageResultExecution timeMemory
999518spensaCombo (IOI18_combo)C++14
5 / 100
1 ms344 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; std::string guess_sequence(int N) { //first letter string p = "AB"; char fir; int tmp1 = press(p); if(tmp1==0){ int tmp2 = press("X"); if(tmp2==1) fir = 'X'; else fir = 'Y'; } else{ int tmp2 = press("A"); if(tmp2==1) fir = 'A'; else fir = 'B'; } set<char> letters; letters.insert('A'); letters.insert('B'); letters.insert('X'); letters.insert('Y'); letters.erase(fir); vector<char> v; for(char i: letters) v.push_back(i); // for(char i: letters) cout<<i<<" "; // cout<<"----\n"; //the rest of the letters string curstr = ""; curstr += fir; // cout<<curstr<<"!!"; p = ""; for(int i=2; i<N; i++){ string S = ""; S += curstr; int tmp = 0; for(char j: letters){ // cout<<j<<" "; if(tmp==0){ S+=j; } else{ S+=curstr; S+=j; S+=v[0]; S+=curstr; S+=j; S+=v[1]; S+=curstr; S+=j; S+=v[2]; break; } tmp++; } // cout<<"\n"<<S<<"\n"; int tmp3 = press(S); int sz = curstr.length(); if(tmp3==(sz)){ curstr+=v[2]; } else if(tmp3==(sz+1)){ curstr+=v[0]; } else{ curstr+=v[1]; } // cout<<curstr<<"\n"; } //last letter string S1 = ""; S1+=curstr; S1+=v[0]; int sz = S1.size(); int tmp = press(S1); if(tmp==sz) curstr+=v[0]; else{ string S = ""; S+=curstr; S+=v[1]; tmp = press(S); if(tmp==sz) curstr+=v[1]; else curstr+=v[2]; } // cout<<curstr<<"\n"; return curstr; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...