제출 #544664

#제출 시각아이디문제언어결과실행 시간메모리
544664LunaMeme콤보 (IOI18_combo)C++14
100 / 100
34 ms588 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> ii; typedef vector<pair<int, int>> vii; typedef vector<int> vi; typedef long long ll; #define PB push_back #define MP make_pair #define FOR(i, x, y) for (ll i = x; i < y ; i ++) #include <combo.h> string guess_sequence(int n){ string s; string l[] = {"A", "B", "X", "Y"}; string start; vector<string> m; if (press("AB")){ if (press("A")){ start ="A"; } else start = "B"; } else if (press("X")) start = "X"; else start = "Y"; s = start; FOR(i, 0, 4){ if (l[i] != start){ m.PB(l[i]); } } FOR(i, 0, n - 2){ int guess = press(s + m[0] + s + m[1] + m[0] + s + m[1] + m[1] + s + m[1] + m[2]); guess -= (i + 1); if (guess == 0){ s += m[2]; } else if (guess == 1){ s += m[0]; } else { s += m[1]; } } if (n == 1) return s; if (press(s + "A" + s + "B") == n){ if (press(s + "A") == n) s += "A"; else s += "B"; } else if (press(s + "X") == n){ s += "X"; } else s += "Y"; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...