Submission #170236

#TimeUsernameProblemLanguageResultExecution timeMemory
170236sochoCombo (IOI18_combo)C++14
5 / 100
1 ms200 KiB
#include "bits/stdc++.h" #include "combo.h" using namespace std; int press(string s); string guess_sequence(int N) { int xy = press("XY"); char first; string oth; if (xy > 0) { // x or y int x = press("X"); if (x > 0) { first = 'X'; oth = "ABY"; } else { first = 'Y'; oth = "ABX"; } } else { // a or b int a = press("A"); if (a > 0) { first = 'A'; oth = "BXY"; } else { first = 'B'; oth = "AXY"; } } string found; found += first; for (int i=1; i<N-1; i++) { // to find this i try a few things int curr = i; string qry = (found + oth[0]) + (found + oth[1] + oth[0]) + (found + oth[1] + oth[1]) + (found + oth[1] + oth[2]); // cout << qry << endl; int res = press(qry); if (res == curr) { found += oth[2]; } else if (res > curr + 1) { found += oth[1]; } else { found += oth[0]; } } if (press(found + oth[0]) == N) { found = found + oth[0]; return found; } if (press(found + oth[1]) == N) { found = found + oth[1]; return found; } found = found + oth[2]; return found; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...