제출 #615389

#제출 시각아이디문제언어결과실행 시간메모리
615389AriaH콤보 (IOI18_combo)C++17
100 / 100
36 ms584 KiB
#include "combo.h" #pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair < int, int > pii; typedef pair < ll, ll > pll; #define F first #define S second #define all(x) x.begin(), x.end() #define SZ(x) (int)x.size() #define Mp make_pair #define endl "\n" #define fast_io ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); const int N = 1e6 + 10; const int LOG = 20; const ll mod = 1e9 + 7; const ll inf = 8e18; string A[4] = {"A", "B", "X", "Y"}; vector < string > vec; string guess_sequence(int n) { mt19937 rng(time(nullptr)); string ans; shuffle(A, A + 4, rng); if(press("XY")) { if(press("X")) ans = "X"; else ans = "Y"; } else { if(press("B")) ans = "B"; else ans = "A"; } for(int j = 0; j < 4; j ++) { if(ans == A[j]) continue; vec.push_back(A[j]); } for(int i = 1; i < n - 1; i ++) { string now2 = ans + vec[2]; string now = ans + vec[1] + now2 + vec[0] + now2 + vec[1] + now2 + vec[2]; ans += vec[press(now) - i]; } if(n - 1) { for(int j = 0; j < 2; j ++) { if(press(ans + vec[j]) == n) { ans += vec[j]; break; } } if(SZ(ans) == n - 1) ans += vec[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...