Submission #121490

#TimeUsernameProblemLanguageResultExecution timeMemory
121490TadijaSebezCombo (IOI18_combo)C++11
100 / 100
51 ms628 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define pb push_back int guess(string s){ return press(s);} string guess_sequence(int n) { string ret; if(guess("AB")) { if(guess("A")) ret='A'; else ret='B'; } else if(guess("X")) ret='X'; else ret='Y'; vector<char> ch; if("A"!=ret) ch.pb('A'); if("B"!=ret) ch.pb('B'); if("X"!=ret) ch.pb('X'); if("Y"!=ret) ch.pb('Y'); for(int i=2;i<=n;i++) { if(i==n) { if(guess(ret+ch[0])==i) ret+=ch[0]; else if(guess(ret+ch[1])==i) ret+=ch[1]; else ret+=ch[2]; continue; } string tmp=ret+ch[0]+ret+ch[1]+ch[0]+ret+ch[1]+ch[1]+ret+ch[1]+ch[2]; int x=guess(tmp); if(x==i) ret+=ch[0]; else if(x==i+1) ret+=ch[1]; else ret+=ch[2]; } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...