제출 #101388

#제출 시각아이디문제언어결과실행 시간메모리
101388Noam527콤보 (IOI18_combo)C++17
100 / 100
51 ms756 KiB
#include <bits/stdc++.h> #define CHECK cout << "ok" << endl #define finish(x) return cout << x << endl, 0 typedef long long ll; typedef long double ldb; const int md = 1e9 + 7; const ll inf = 1e18; const int OO = 1; const int OOO = 0; using namespace std; //#include "combo.h" int press(string s); int ask(string s) { if (OOO) { cout << "? " << s << endl; int rtn; cin >> rtn; return rtn; } return press(s); } string guess_sequence(int N) { string ans; string opt; if (ask("AB")) { if (ask("A")) { ans = "A"; opt = "BXY"; } else { ans = "B"; opt = "AXY"; } } else { if (ask("X")) { ans = "X"; opt = "BAY"; } else { ans = "Y"; opt = "BXA"; } } if (N == 1) return ans; for (int i = 1; i < N - 1; i++) { int val = ask( ans + opt[0] + opt[0] + ans + opt[0] + opt[1] + ans + opt[0] + opt[2] + ans + opt[1] ) - i; ans.push_back(opt[2 - val]); } if (ask(ans + 'A' + ans + 'B') == N) { if (ask(ans + 'A') == N) return ans + 'A'; return ans + 'B'; } if (ask(ans + 'X') == N) return ans + 'X'; return ans + 'Y'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...