제출 #77352

#제출 시각아이디문제언어결과실행 시간메모리
77352Just_Solve_The_Problem콤보 (IOI18_combo)C++11
100 / 100
50 ms572 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 (N == 1) return ans; 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...