제출 #798293

#제출 시각아이디문제언어결과실행 시간메모리
798293HaroldVemeno콤보 (IOI18_combo)C++17
100 / 100
27 ms488 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string res = ""; string c = ""; if(press("AB")) { if(press("A")) res += "A"; else res += "B"; } else { if(press("X")) res += "X"; else res += "Y"; } if(N == 1) return res; string ls = "ABXY"; for(int i = 0; i < 4; ++i) { if(ls[i] == res[0]) { ls[i] = ls.back(); ls.pop_back(); break; } } for(int i = 1; i < N-1; ++i) { c.clear(); c += res; c += ls[0]; c += ls[0]; c += res; c += ls[0]; c += ls[1]; c += res; c += ls[0]; c += ls[2]; c += res; c += ls[1]; int t = press(c); int m = res.size(); if(t == m) { res += ls[2]; } else if(t == m+1) { res += ls[1]; } else if(t == m+2) { res += ls[0]; } } { if(press(res + ls[0]) == N) { res += ls[0]; } else if(press(res + ls[1]) == N) { res += ls[1]; } else { res += ls[2]; } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...