# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
787183 | resolve100 | Combo (IOI18_combo) | C++14 | 0 ms | 0 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<bits/stdc++.h>
#include "combo.h"
#define ll long long
#define ull unsigned ll
#define pb push_back
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define read_file freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
using namespace std;
string chars[] = {"A", "B", "X", "Y"};
string guess_sequence(int N){
string out;
int no;
for (int i = 0; i < 3; i++){
int num = press(chars[i]);
if (num){
out.append(chars[i]);
no = i;
break;
}
}
if (out.size() == 0) out.pb(chars[3]);
for (int i = 1; i < N; i++){
if (no == 3){
for (int j = 2; j > 1; j--){
int num = press(out+chars[j]);
if (num == i+1){
out.append(chars[j]);
break;
}
}
if (out.size() == i) out.append(arr[0]);
}
else{
for (int j = 0; j < 3; j++){
if (i == j) continue;
int num = press(out+chars[i]);
if (num == i+1){
out.append(chars[i]);
break;
}
}
if (out.size() == i) out.append(arr[3]);
}
}
return out;
}