Submission #1283691

#TimeUsernameProblemLanguageResultExecution timeMemory
1283691muhammad-ahmad콤보 (IOI18_combo)C++20
30 / 100
13 ms484 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; for (int i = 0; i < 4; i++){ fi = b[i]; if (i == 3) break; int x = press(fi); if (x == 1){ break; } } vector<string> se; for (auto i : b){ if (i != fi) se.push_back(i); } int lstx = 1; string ans; for (int i = 0; i < n - 1; i++){ string q1 = fi + ans + se[0] + fi; string q2 = fi + ans + se[1] + fi; int x1 = press(q1); int x2 = press(q2); if (x1 == lstx + 1){ ans += se[0]; } else if (x2 == lstx + 1){ ans += se[1]; } else { ans += se[2]; } lstx++; } return (fi + ans); // cout << "! " << fi + ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...