Submission #713410

#TimeUsernameProblemLanguageResultExecution timeMemory
713410lamCombo (IOI18_combo)C++14
100 / 100
39 ms652 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; int n; string guess_sequence(int N) { n=N; string p = "AB"; int coins = press(p); char dau; if (coins>=1) { p="A"; coins = press(p); if (coins>=1) dau = 'A'; else dau = 'B'; } else { p="X"; coins = press(p); if (coins>=1) dau = 'X'; else dau = 'Y'; } string S=""; S+=dau; if (n==1) return S; vector <char> tmp; if (dau!='A') tmp.push_back('A'); if (dau!='B') tmp.push_back('B'); if (dau!='X') tmp.push_back('X'); if (dau!='Y') tmp.push_back('Y'); for (int i=2; i+1<=n; i++) { p=""; p+=S+tmp[0]; for (char j:tmp) p+=S+tmp[1]+j; coins = press(p); if (coins==i) S+=tmp[0]; else if (coins>i) S+=tmp[1]; else S+=tmp[2]; } p=""; p+=S+tmp[0]; p+=S+tmp[1]; coins = press(p); if (coins==n) { p=""; p+=S+tmp[0]; coins = press(p); if (coins==n) S+=tmp[0]; else S+=tmp[1]; } else S+=tmp[2]; return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...