Submission #77350

#TimeUsernameProblemLanguageResultExecution timeMemory
77350Just_Solve_The_ProblemCombo (IOI18_combo)C++11
5 / 100
2 ms268 KiB
#include <bits/stdc++.h> // #include "grader.cpp" #include "combo.h" #define pb push_back #define sz(s) (int)s.size() using namespace std; char c[] = {'A', 'B', 'X', 'Y'}; int ask(string s) { return press(s); } string guess_sequence(int N) { string ans; if (ask("AB")) if (ask("A")) ans.pb('A'); else ans.pb('B'); else if (ask("X")) ans.pb('X'); else ans.pb('Y'); vector < char > vec; for (int i = 0; i < 4; i++) { if (c[i] == ans[0]) continue; vec.pb(c[i]); } for (int i = 1; i < N - 1; i++) { int temp = ask(ans + vec[0] + vec[0] + ans + vec[0] + vec[1] + ans + vec[0] + vec[2] + ans + vec[1]); if (temp == sz(ans)) { ans.pb(vec[2]); } else if (temp == sz(ans) + 1) { ans.pb(vec[1]); } else { ans.pb(vec[0]); } } if (ask(ans + vec[0]) == N) ans.pb(vec[0]); else if (ask(ans + vec[1]) == N) ans.pb(vec[1]); else ans.pb(vec[2]); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...