Submission #574629

#TimeUsernameProblemLanguageResultExecution timeMemory
574629KrisjanisPCombo (IOI18_combo)C++14
100 / 100
32 ms612 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; string guess_sequence(int N) { string res = ""; if (press("AB") >= 1) { if (press("A") == 1) res = "A"; else res = "B"; } else { if (press("X") == 1) res = "X"; else res = "Y"; } if (N == 1) return res; char a[3] = {'A', 'B', 'X'}; for (ll i = 0; i < 3; i++) if (a[i] == res[0]) a[i] = 'Y'; for (ll i = 1; i < N - 1; i++) { string query = ""; query += res + a[0]; for (ll j = 0; j < 3; j++) query += res + a[1] + a[j]; ll w = press(query), p = res.size(); if (w == p + 1) res += a[0]; else if (w == p + 2) res += a[1]; else res += a[2]; } if(press(res+a[0]+res+a[1])==N) if(press(res+a[0])==N) res+=a[0]; else res+=a[1]; else res += a[2]; return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...