제출 #1085408

#제출 시각아이디문제언어결과실행 시간메모리
1085408mingga콤보 (IOI18_combo)C++17
30 / 100
29 ms2200 KiB
#include "bits/stdc++.h" #include "combo.h" using namespace std; #define ln "\n" #define dbg(x) cout << #x << " = " << x << ln #define mp make_pair #define pb push_back #define fi first #define se second #define inf 2e18 #define fast_cin() \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define out(file) freopen(file, "w", stdout) #define in(file) freopen(file, "r", stdin) #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) // #define int long long int MOD = 1e9 + 7; string d[4] = {"A", "B", "X", "Y"}; string guess_sequence(int n) { string ans = ""; if(press("AB") > 0) { if(press("A") == 1) ans += 'A'; else ans += 'B'; } else { if(press("X") == 1) ans += 'X'; else ans += 'Y'; } string fir = ans; vector<string> vec; for(int i = 0; i < 4; i++) { if(d[i] == fir) continue; vec.pb(d[i]); } int st = 1; if((n-1) % 2 != 0) { st = 2; string tmp = ans + vec[0]; if(press(tmp) == 2) ans += vec[0]; else { tmp = ans + vec[1]; if(press(tmp) == 2) ans += vec[1]; else ans += vec[2]; } } // if(n == 3) { // for(int i = 0; i < 3; i++) { // for(int j = 0; j < 3; j++) { // string tmp = ans + vec[i] + vec[j]; // if(press(tmp) == n) { // return tmp; // } // } // } // } for(int i = st; i < n; i+=2) { string tmp = ans + vec[0] + vec[1] + ans + vec[1] + vec[0] + ans + vec[1] + vec[1] + ans + vec[0] + vec[0]; // cout << tmp << ln; int cur = press(tmp); if(cur == sz(ans)) { tmp = ans + vec[2] + vec[0]; string tmp2 = ans + vec[2] + vec[1]; if(press(tmp) == sz(ans) + 2) ans += vec[2] + vec[0]; else if(press(tmp2) == sz(ans) + 2) ans += vec[2] + vec[1]; else ans += vec[2] + vec[2]; } else if(cur == sz(ans) + 1) { tmp = ans + vec[1] + vec[2]; if(press(tmp) == sz(ans) + 2) ans += vec[1] + vec[2]; else ans += vec[0] + vec[2]; } else { tmp = ans + vec[1] + vec[1]; int sus = press(tmp); if(sus == sz(ans)) { tmp = ans + vec[0] + vec[1]; if(press(tmp) == sz(ans) + 2) ans += vec[0] + vec[1]; else ans += vec[0] + vec[0]; } else if(sus == sz(ans) + 1) { ans += vec[1] + vec[0]; } else { ans += vec[1] + vec[1]; } } } return ans; } // signed main() { // string a = ""; // a += d[1] + d[2] + d[0]; // string tmp = a + d[0] + a + d[1] + a + d[2] + a + d[3]; // cout << tmp; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...