Submission #1241606

#TimeUsernameProblemLanguageResultExecution timeMemory
1241606whatisdpCombo (IOI18_combo)C++17
5 / 100
0 ms396 KiB
#ifndef G #include "combo.h" #endif std::string cs[4] = {"A", "B", "X", "Y"}; std::string guess_sequence(int N) { using str = std::string; str s; int l=0; for (int i=0;i<4;i++) { if (press(cs[i])) { s = cs[i]; swap(cs[i], cs[3]); break; } } str cs2[3]; for(int i=0;i<3;i++) { cs2[i] = cs[i]; } for(int i=0;i<3;i++) { // std::cout<<i<<" : \""<<cs2[i]<<"\"\n"; } for (int i=1;i<N-1;i++) { str z; for(int j=0;j<3;j++) z += s + cs2[0] + cs2[j]; z += s + cs2[1]; int r = press(z); if (r == i+2) s += cs2[0]; else if (r == i+1) s += cs2[1]; else s += cs2[2]; } // std::cout<<"s: "<<s<<'\n'; for(int i=0;i<3;i++) { if (press(s + cs2[i]) == N) return s + cs2[i]; } return ""; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...