Submission #903908

#TimeUsernameProblemLanguageResultExecution timeMemory
903908zhasynCombo (IOI18_combo)C++14
30 / 100
28 ms1888 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 check, s = "ABXY"; int fir, n1, n2, n3; void create(int cur, int sz, string next){ if(cur == sz){ check += next; return; } create(cur + 1, sz, next + s[n1]); create(cur + 1, sz, next + s[n2]); } string guess_sequence(int n){ 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]; int cur = 1; 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; } } while(cur < n){ int sz = cur, cnt = 1; while(true){ if((sz + 1) * cnt * 2 > 4 * n || sz + 1 > n){ check = ""; create(cur, sz, ans); int res = press(check); while(cur < res){ if(press(ans + s[n1]) == cur + 1){ ans += s[n1]; } else ans += s[n2]; cur++; } if(res < sz){ ans += s[n3]; cur++; } break; } sz++; cnt *= 2; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...