# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
600580 | enerelt14 | Combo (IOI18_combo) | C++17 | 2 ms | 464 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>
#define pb push_back
using namespace std;
int n;
string guess_sequence(int N){
string ans;
n=N;
string p;
string x;
for (int i=0;i<n;i++){
if (i==0){
p+='A';
for (int i=1;i<4*n;i++)p+='B';
if (press(p)>0){
p.clear();
for (int i=0;i<4*n;i++)p+='A';
if (press(p)>0){
ans+='A';
x+='B';x+='X';x+='Y';
}
else{
ans+='B';
x+='A';x+='X';x+='Y';
}
p.clear();
continue;
}
p.clear();
for (int i=0;i<4*n;i++)p+='X';
if (press(p)>0){
ans+='X';
x+='B';x+='A';x+='Y';
}
else{
ans+='Y';
x+='B';x+='X';x+='A';
}
p.clear();
continue;
}
if (i==n-1){
p+=ans;
for (int i=ans.size();i<4*n;i++)p+=x[0];
if (press(p)){
ans+=x[0];
return ans;
}
p.clear();
p+=ans;
for (int i=ans.size();i<4*n;i++)p+=x[1];
if (press(p)){
ans+=x[1];
return ans;
}
ans+=x[2];
return ans;
}
for (int i=0;i<4;i++){
p+=ans;
if (i==0){
p+=x[0];
for (int i=ans.size()+1;i<n;i++)p+=ans[0];
continue;
}
p+=x[1];
p+=x[i-1];
for (int i=ans.size()+2;i<n;i++)p+=ans[0];
}
int y=press(p);
if (y==ans.size())ans+=x[2];
if (y==ans.size()+1)ans+=x[0];
if (y==ans.size()+2)ans+=x[1];
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |