Submission #290570

#TimeUsernameProblemLanguageResultExecution timeMemory
290570gabrc52Combo (IOI18_combo)C++14
30 / 100
65 ms544 KiB
#include <iostream> #include <string> #define watch(x) cerr<<#x<<": "<<(x)<<endl #include "combo.h" using namespace std; char getFirst() { if (press("AB") >= 1) { return press("A")==1 ? 'A' : 'B'; } else { return press("X")==1 ? 'X' : 'Y'; } } string valid = "ABXY"; string newValid(string s, char first) { string r; for (char c : s) { if (c != first) { r.push_back(c); } } return r; } int sz(string s) { return s.size(); } string guess_sequence(int N) { string p,S; char first = getFirst(); S.push_back(first); watch(first); valid = newValid(valid,first); watch(valid); for (int i=2; i<=N; i++) { if (press(S+valid[0]+S+valid[1]) == sz(S)) { S.push_back(valid[2]); } else if (press(S+valid[0]) == sz(S)) { S.push_back(valid[1]); } else { S.push_back(valid[0]); } } watch(S); return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...