Submission #259477

#TimeUsernameProblemLanguageResultExecution timeMemory
259477iliccmarkoCombo (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; std::string guess_sequence(int n) { string p; int l = 0; if(press("AB")) { if(press("A")) { p.push_back('A'); } else { p.push_back('B'); } } else { if(press("X")) { p.push_back('X'); } else { p.push_back('Y'); } } char a, b, c; if(p[0]=='A') { a = 'B'; b = 'X'; c = 'Y'; } else if(p[0]=='B') { a = 'A'; b = 'X'; c = 'Y'; } else if(p[0]=='X') { a = 'A'; b = 'B'; c = 'Y'; } else { a = 'A'; b = 'B'; c = 'C'; } l = 1; while(l!=n) { string s; s = ""; if(l==n-1) { s=p; s.push_back(a); if(press(s)==n) return s; s[n-1] = b; if(press(s)==n) return s; s[n-1] = c; return s; } s+=p; s.push_back(a); s.push_back(a); s+=p; s.push_back(a); s.push_back(b); s+=p; s.push_back(a); s.push_back(c); s+=p; s.push_back(b); int k = press(s); if(k==l+2) { p.push_back(a); } else if(k==l+1) { p.push_back(b); } else { p.push_back(c); } l++; } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...