제출 #862333

#제출 시각아이디문제언어결과실행 시간메모리
862333aykhn콤보 (IOI18_combo)C++14
100 / 100
13 ms1960 KiB
#include "combo.h" #include <bits/stdc++.h> // author : aykhn using namespace std; typedef long long ll; #define pb push_back #define ins insert #define mpr make_pair #define all(v) v.begin(), v.end() #define bpc __builtin_popcount #define bpcll __builtin_popcountll #define pii pair<int, int> #define pll pair<ll, ll> #define fi first #define se second #define infll 0x3F3F3F3F3F3F3F3F #define inf 0x3F3F3F3F string guess_sequence(int N) { string res = ""; int x = press("AB"); if (x) { x = press("A"); if (x) res = "A"; else res = "B"; } else { x = press("X"); if (x) res = "X"; else res = "Y"; } if (N == 1) return res; string temp = "ABXY"; string ch; for (int i = 0; i < 4; i++) if (temp[i] != res[0]) ch.pb(temp[i]); int prev = 1; int cnt = 2; for (int i = 1; i + 1 < N; i++) { string s = res; s.pb(ch[0]); s += res; s.pb(ch[1]); s.pb(ch[0]); s += res; s.pb(ch[1]); s.pb(ch[1]); s += res; s.pb(ch[1]); s.pb(ch[2]); x = press(s); cnt++; if (x == prev) res.pb(ch[2]); else if (x == prev + 1) res.pb(ch[0]); else res.pb(ch[1]); prev++; } res.pb(ch[0]); x = press(res); if (x == prev + 1) return res; res.pop_back(); res.pb(ch[1]); x = press(res); if (x == prev + 1) return res; res.pop_back(); res.pb(ch[2]); return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...