Submission #827131

#TimeUsernameProblemLanguageResultExecution timeMemory
827131HamletPetrosyanCombo (IOI18_combo)C++17
5 / 100
1 ms208 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define len(a) ((int)(a).size()) string guess_sequence(int N) { string p = ""; int x; char ch[4] = {'A', 'B', 'X', 'Y'}; x = press("AB"); if(x == 2) p += "AB"; else if(x){ x = press("A"); if(x) p += "A"; else p += "B"; } else{ x = press("X"); if(x) p += "X"; else p += "Y"; } if(N == 1) return p; vector<char> v; for(int i = 0; i < 4; i++){ if(ch[i] == p[0]) continue; v.push_back(ch[i]); } for(int i = len(p) + 1; i < N; i++){ x = press(p + v[0] + p + v[1] + v[0] + p + v[1] + v[1] + p + v[1] + v[2]); if(x == len(p) + 1) p += v[0]; else if(x == len(p) + 2) p += v[1]; else p += v[2]; } x = press(p + v[0]); if(x == N) p += v[0]; else{ x = press(p + v[1]); if(x == N) p += v[1]; else p += v[2]; } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...