Submission #1283772

#TimeUsernameProblemLanguageResultExecution timeMemory
1283772muhammad-ahmadCombo (IOI18_combo)C++20
0 / 100
1 ms332 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; // int press(string p){ // cout << p << endl; // int c; cin >> c; // return c; // } // int main(){ int n; cin >> n; string guess_sequence(int n){ vector<string> b = {"A", "B", "X", "Y"}; string fi; int x = press("AB"); if (x > 0){ x = press("A"); if (x > 0) fi = "A"; else fi = "B"; } else { x = press("C"); if (x > 0) fi = "C"; else fi = "D"; } string ans; vector<string> c; for (auto i : b){ if (i != fi) c.push_back(i); } for (int i = 2; i < n - 1; i++){ string query = fi + ans + c[0]; for (auto j : c){ query += fi + ans + c[1] + j; } x = press(query); if (x == i) ans += c[0]; else if (x >= i + 1) ans += c[1]; else ans += c[2]; } string q1 = fi + ans + c[0], q2 = fi + ans + c[1]; x = press(q1); if (x > 0) return q1; x = press(q2); if (x > 0) return q2; return fi + ans + c[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...