Submission #903914

#TimeUsernameProblemLanguageResultExecution timeMemory
903914zhasynCombo (IOI18_combo)C++14
5 / 100
1 ms496 KiB
#include "combo.h" #include <bits/stdc++.h> #define pb push_back #define pf push_front using namespace std; #define F first #define S second typedef long long ll; #define pii pair <int, int> #define pll pair <ll, ll> typedef long double ld; const ll N = 2 * 1e5 + 10, len = 316; const ll mod = 1e9 + 7; ll um(ll a, ll b){ return ((1LL * a * b) % mod + mod) % mod; } ll subr(ll a, ll b){ return ((1LL * a - b) % mod + mod) % mod; } string guess_sequence(int n){ int fir, n1, n2, n3; string s = "ABXY"; n1 = n2 = n3 = -1; if(press("AB") >= 1){ if(press("A") == 1) fir = 0; else fir = 1; } else{ if(press("X") == 1) fir = 2; else fir = 3; } string ans = ""; ans += s[fir]; for(int i = 0; i < 4; i++){ if(i == fir) continue; if(n1 == -1) n1 = i; else{ if(n2 == -1) n2 = i; else n3 = i; } } for(int i = 1; i < n - 1; i++){ string check = ans + s[n1] + ans + s[n2] + s[n1]; check = check + ans + s[n2] + s[n2] + ans + s[n2] + s[n3]; int res = press(check); if(res == i + 1) ans += s[n1]; else{ if(res == i + 2) ans += s[n2]; else ans += s[n3]; } } if(press(ans + s[n1]) == n) ans += s[n1]; else{ if(press(ans + s[n2]) == n) ans += s[n2]; else ans += s[n3]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...