제출 #568186

#제출 시각아이디문제언어결과실행 시간메모리
568186stevancv콤보 (IOI18_combo)C++14
100 / 100
35 ms572 KiB
#include <bits/stdc++.h> #include "combo.h" #define ll long long #define ld long double #define sp ' ' #define en '\n' using namespace std; const int N = 1e5 + 2; const ll mod = 1e9 + 7; string guess_sequence(int n) { string ans; if (press("AB")) { if (press("A")) ans += 'A'; else ans += 'B'; } else { if (press("X")) ans += 'X'; else ans += 'Y'; } vector<char> v; if (ans[0] != 'A') v.push_back('A'); if (ans[0] != 'B') v.push_back('B'); if (ans[0] != 'X') v.push_back('X'); if (ans[0] != 'Y') v.push_back('Y'); for (int i = 1; i < n; i++) { if (i < n - 1) { string tmp; for (int j = 0; j < 3; j++) { tmp += ans; tmp += v[0]; tmp += v[j]; } tmp += ans; tmp += v[1]; int x = press(tmp); if (x == i + 2) ans += v[0]; else if (x == i + 1) ans += v[1]; else ans += v[2]; } else { string tmp = ans; tmp += v[0]; if (press(tmp) == n) { ans += v[0]; continue; } tmp = ans; tmp += v[1]; if (press(tmp) == n) { ans += v[1]; } else { ans += v[2]; } } } return ans; } /*int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; cout << guess_sequence(n) << en; return 0; } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...