제출 #547129

#제출 시각아이디문제언어결과실행 시간메모리
547129beedle콤보 (IOI18_combo)C++17
5 / 100
1 ms208 KiB
#include <iostream> #include <iomanip> #include <vector> #include <algorithm> #include <set> #include <iterator> #include <stack> #include <map> #include <math.h> #include <bitset> #include <deque> #include <string> #include <tuple> #include <queue> #include <numeric> #include <unordered_set> #include <unordered_map> #define pi 3.141592653589793238 #define ll long long #define ld long double #define rep(i, a, b) for (long long i = a; i <= b; i++) #define mod 1000000007ll #define INF 1000000000000000000 #define pb push_back #define ff first #define ss second #define endl '\n' #define all(x) (x).begin (), (x).end () #define sz(x) (ll) (x).size () #define reunique(v) v.resize(std::unique(v.begin(), v.end()) - v.begin()) #define rank rnk #define log lg #define fast \ ios_base::sync_with_stdio (false); \ cin.tie (NULL); \ cout.tie (NULL) using namespace std; int press(string p); vector <char> pos={'A','B','X','Y'}; vector <char> p1={'A','B'}; vector <char> p2={'X','Y'}; string setup(string ans) { int out=press(ans+p1[0]+ans+p1[1]); if(out>=sz(ans)+1) { out=press(ans+p1[0]); if(out==sz(ans)+1) ans.pb('A'); else ans.pb('B'); } else { out=press(ans+p2[0]); if(out==sz(ans)+1) ans.pb('X'); else ans.pb('Y'); } return ans; } string guess_sequence(int n) { string ans=""; ans=setup(ans); vector <char> avail; for(auto c:pos) if(c!=ans[0]) avail.pb(c); rep(i,1,n-2) { int out=press(ans+avail[0]+ans+avail[1]+avail[0]+ans+avail[1]+avail[1]+ans+avail[1]+avail[2]); if(out==sz(ans)) ans.pb(avail[2]); else if(out==sz(ans)+1) ans.pb(avail[0]); else ans.pb(avail[1]); } ans=setup(ans); return ans; } // signed main() // { // fast; // freopen("milkorder.in","r",stdin); // freopen("milkorder.out","w",stdout); // string s=guess_sequence(4); // cout<<s<<endl; // return 0; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...