# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1006828 | makanhulia | Combo (IOI18_combo) | C++17 | 29 ms | 968 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
// int press(string hm) {
// cout << hm << endl;
// int ans;cin>>ans;
// return ans;
// }
string S = "ABXY";
char getpatokan() {
int res1 = press("AB"), res2 = press("BX");
if (res1 && res2) return 'B';
else if (res1) return 'A';
else if (res2) return 'X';
else return 'Y';
}
// ABXYBYYXB
// patokan: A
// BXYBYYXB
// ABAX
// AXAY
//
string guess_sequence(int n) {
char patokan = getpatokan();
set<char> st{'A', 'B', 'X', 'Y'};
st.erase(patokan);
string now;
now += patokan;
for (int i = 0; i < n-1; i++) {
auto it = st.begin();
char gok = *it;
it++;
for (int j = 0; j < 2; j++) {
char x = *it;
it++;
if (press(now + x) == now.length()+1) {
gok = x;
break;
}
}
now += gok;
}
return now;
}
// int main() {
// int n;cin>>n;
// cout << guess_sequence(n) << endl;
// }
// string guess_sequence(int N) {
// string permu = "AAAABBBBXXXXYYYY";
// do {
// cout << permu << endl;
// } while (next_permutation(all(permu)));
// }
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |