제출 #1083064

#제출 시각아이디문제언어결과실행 시간메모리
1083064KasymK콤보 (IOI18_combo)C++17
100 / 100
24 ms1356 KiB
#include "bits/stdc++.h" #include "combo.h" using namespace std; #define ff first #define ss second #define all(v) v.begin(), v.end() #define ll long long #define pb push_back #define pii pair<int, int> #define pli pair<ll, int> #define pll pair<ll, ll> #define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i) #define wr puts("----------------") template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} string guess_sequence(int n){ string tm = "ABXY"; vector<char> use; string ans = ""; if(press("AB")){ if(press("A")){ for(int i = 1; i <= 3; ++i) use.pb(tm[i]); ans += "A"; } else{ use.pb('A'); for(int i = 2; i <= 3; ++i) use.pb(tm[i]); ans += "B"; } } else{ if(press("X")){ for(int i = 0; i <= 1; ++i) use.pb(tm[i]); use.pb('Y'); ans += "X"; } else{ for(int i = 0; i <= 2; ++i) use.pb(tm[i]); ans += "Y"; } } assert((int)use.size() == 3); if(n == 1) return ans; int x = 0; for(int i = 0; i < n-2; ++i){ int s = (int)ans.size(); x = press(ans+use[0]+ans+use[1]+use[0]+ans+use[1]+use[1]+ans+use[1]+use[2]); if(x == s+1) ans += use[0]; else if(x == s+2) ans += use[1]; else ans += use[2]; } if(press(ans+use[0]) == n) ans += use[0]; else if(press(ans+use[1]) == n) ans += use[1]; else ans += use[2]; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...