제출 #281716

#제출 시각아이디문제언어결과실행 시간메모리
281716MrDomino콤보 (IOI18_combo)C++14
100 / 100
39 ms572 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string del(string s, char ch) { string t; for (auto &x : s) { if (x != ch) { t += x; } } return t; } string mult(char ch, int x) { string s; for (int i = 1; i <= x; i++) { s += ch; } return s; } string guess_sequence(int n) { string sol; string posi = "ABXY"; if (press(sol + posi[0] + posi[1]) > 0) { if (press(sol + posi[0])) { sol += posi[0]; } else { sol += posi[1]; } } else { if (press(sol + posi[2])) { sol += posi[2]; } else { sol += posi[3]; } } posi = del(posi, sol[0]); while ((int) sol.size() + 2 <= n) { char a = posi[0]; char b = posi[1]; char c = posi[2]; int ret = press(sol + a + a + sol + a + b + sol + a + c + sol + b); if (ret == (int) sol.size() + 2) { sol += a; continue; } if (ret == (int) sol.size() + 1) { sol += b; continue; } sol += c; } if ((int) sol.size() == n - 1) { char a = posi[0]; char b = posi[1]; char c = posi[2]; if (press(sol + a) == n) { sol += a; } else { if (press(sol + b) == n) { sol += b; } else { sol += c; } } } return sol; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...