Submission #373585

#TimeUsernameProblemLanguageResultExecution timeMemory
373585BartolMCombo (IOI18_combo)C++17
5 / 100
2 ms200 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define X first #define Y second #define mp make_pair #define pb push_back typedef long long ll; typedef pair <int, int> pii; typedef pair <int, pii> pip; typedef pair <pii, int> ppi; typedef pair <ll, ll> pll; const int INF=0x3f3f3f3f; string prvi, sl=""; string sol=""; string guess_sequence(int n) { int x=press("AB"); if (x) { x=press("A"); if (x) prvi="A"; else prvi="B"; } else { x=press("X"); if (x) prvi="X"; else prvi="Y"; } for (char c:"ABXY") if (c!=prvi[0]) sl+=c; sol=prvi; for (int i=2; i<n; ++i) { string curr=sol+sl[0]+sol+sl[1]+sl[0]+sol+sl[1]+sl[1]+sol+sl[1]+sl[2]; int x=press(curr); if (x==i) sol+=sl[0]; else if (x==i+1) sol+=sl[1]; else sol+=sl[2]; } if (press(sol+sl[0])==n) return sol+sl[0]; if (press(sol+sl[1])==n) return sol+sl[1]; return sol+sl[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...