| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 127853 | super_j6 | 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 <iostream>
#include <cstdio>
#include <algorithm>
#include <string.h>
using namespace std;
#define endl '\n'
string s = "";
char c[4] = {'A', 'B', 'X', 'Y'};
int bad = 4;
string guess_sequence(int n){
return s;
}
char r(int x){
return c[x + (x >= bad)];
}
void find1(){
if(press(s + r(0) + s + r(1)) > 0){
if(press(s + r(0))){
s += r(0);
bad = 0;
}else{
s += r(1);
bad = 1;
}
}else{
if(press(s + r(2))){
s += r(2);
bad = 2;
}else{
s += r(3);
bad = 3;
}
}
}
void find2(){
int x = press(s + r(1) + s + r(2) + r(0) + s + r(2) + r(1) + s + r(2) + r(2));
if(x == 0){
s += r(0);
}else if(x == 1){
s += r(1);
}else{
s += r(2);
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
for(int i = 0; i < n; i++){
if(i == 0 || i == n - 1) find1();
else find2();
}
return 0;
}
