# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
406065 | Waratpp123 | Combo (IOI18_combo) | C++14 | 2 ms | 292 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;
string ans,p;
char a[4];
string guess_sequence(int N) {
int c1=press("AB"),c;
int c2=press("AX");
char f;
if(c1==0&&c2==0){
f='Y';
a[0]='Y';
a[1]='A';
a[2]='B';
a[3]='X';
}
if(c1==0&&c2>=1){
f='X';
a[0]='X';
a[1]='A';
a[2]='B';
a[3]='Y';
}
if(c1>=1&&c2==0){
f='B';
a[0]='B';
a[1]='A';
a[2]='Y';
a[3]='X';
}
if(c1>=1&&c2>=1){
f='A';
a[0]='A';
a[1]='Y';
a[2]='B';
a[3]='X';
}
ans=a[0];
for (int i = 1; i <= N-2; ++i) {
p.clear();
p+=ans;
p+=a[1];
p+=a[1];
p+=ans;
p+=a[1];
p+=a[2];
p+=ans;
p+=a[1];
p+=a[3];
p+=ans;
p+=a[2];
c=press(p);
if(c==i) ans.push_back(a[3]);
if(c==i+1) ans.push_back(a[2]);
if(c==i+2) ans.push_back(a[1]);
}
p.clear();
p=ans+a[1];
c=press(p);
if(c==N) return p;
p.clear();
p=ans+a[2];
c=press(p);
if(c==N) return p;
p.clear();
p=ans+a[3];
return p;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |