Submission #1256866

#TimeUsernameProblemLanguageResultExecution timeMemory
1256866kawhietCombo (IOI18_combo)C++20
100 / 100
7 ms484 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n) { string s; if (press("AB")) { if (press("A")) s = "A"; else s = "B"; } else { if (press("X")) s = "X"; else s = "Y"; } if (n == 1) { return s; } string a = "ABXY"; a.erase(remove(a.begin(), a.end(), s[0]), a.end()); while (s.size() < n - 1) { string p = s + a[0] + s + a[1] + a[0] + s + a[1] + a[1] + s + a[1] + a[2]; int res = press(p) - s.size(); if (res == 0) { s += a[2]; } else if (res == 1) { s += a[0]; } else { s += a[1]; } } if (press(s + a[0]) == n) { s += a[0]; } else if (press(s + a[1]) == n) { s += a[1]; } else { s += a[2]; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...