제출 #1138840

#제출 시각아이디문제언어결과실행 시간메모리
1138840AmirMakaMCombo (IOI18_combo)C++20
100 / 100
7 ms484 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; #define ull unsigned long long #define ll long long #define ld long double #define pb push_back #define f first #define s second #define sz(x) (int)x.size() #define all(x) x.begin(),x.end() #define pii pair<int,int> // #define pll pair<ll,ll> #define pld pair<ld,ld> #define pdd pair<double,double> #define mp make_pair #define AmirMakaM ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) // solve it //const ull SEED = chrono::steady_clock::now().time_since_epoch().count(); //mt19937_64 mrand(SEED); //ull rnd(ull x = ~(0ull)) {return mrand() % x;} const ll MOD = 1e9 + 7; const ll INF = 1e16+20; const int inf = 1e9 + 7; //const ll N = 1e5+1; const ll M = 2e3+1; const double pi = 2*acos(0.0); const int dx[] = {1,-1,0,0}, dy[] = {0,0,1,-1}; string guess_sequence(int n) { string a[4] = {"A","B","X","Y"}; if(n == 1) { for(int j=0; j<4; j++) { if(j == 3 || press(a[j]) == 1) { return a[j]; } } } string ans = ""; int id = -1; string cur1 = a[1]+a[0]; int cnt1 = press(cur1); if(cnt1) { string cur2 = a[1]; int cnt2 = press(cur2); if(cnt2) { ans += a[1], id = 1; } else { ans += a[0], id = 0; } } else { string cur2 = a[2]; int cnt2 = press(cur2); if(cnt2) { ans += a[2], id = 2; } else { ans += a[3], id = 3; } } vector<string> b; for(int j=0; j<4; j++) { if(id!=j) b.pb(a[j]); } for(int i=2; i<=n-1; i++) { string cur = ans+b[0]+ans+b[1]+b[0]+ans+b[1]+b[1]+ans+b[1]+b[2]; int cnt = press(cur); if(cnt == i-1) { ans += b[2]; } else if(cnt == i) { ans += b[0]; } else { ans += b[1]; } } for(int i=0; i<3; i++) { if(i == 2 || press(ans+b[i]) == n) { ans += b[i]; break; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...