Submission #277036

#TimeUsernameProblemLanguageResultExecution timeMemory
277036ASDF123Combo (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include "combo.h" #include <bits/stdc++.h> #define fr first #define sc second #define pii pair<int, int> #define szof(s) (int)s.size() #define all(s) s.begin(), s.end() using namespace std; //int press(string s) { // return 0; //} string get(string pref) { if (press(pref + "A") == 1) { return "A"; } else if (press(pref + "B") == 1) { return "B"; } else if (press(pref + "X") == 1) { return "X"; } else { return "Y"; } } string guess_sequence(int n) { string bad; string s = get(""); bad = s; for (int i = 1; i <= n - 2; i++) { // we guess i + 1 character int cost; if (bad == "A") { cost = press(s + "B" + s + "XY" + s + "XX" + s + "XB"); if (cost == szof(s)) { s += 'Y'; } if (cost == szof(s) + 1) { s += 'B'; } if (cost == szof(s) + 2) { s += 'X'; } } if (bad == "B") { cost = press(s + "A" + s + "XY" + s + "XX" + s + "XA"); if (cost == szof(s)) { s += 'Y'; } if (cost == szof(s) + 1) { s += 'A'; } if (cost == szof(s) + 2) { s += 'X'; } } if (bad == "X") { // { A B Y } cost = press(s + "A" + s + "BA" + s + "BB" + s + "BY"); if (cost == szof(s)) { s += 'Y'; } if (cost == szof(s) + 1) { s += 'A'; } if (cost == szof(s) + 2) { s += 'B'; } } if (bad == "Y") { // { A B X } cost = press(s + "A" + s + "BA" + s + "BB" + s + "BX"); if (cost == szof(s)) { s += 'X'; } if (cost == szof(s) + 1) { s += 'A'; } if (cost == szof(s) + 2) { s += 'B'; } } } s += get(s); return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...