# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
600671 | enerelt14 | Combo (IOI18_combo) | C++14 | 1 ms | 336 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;
int n;
string guess_sequence(int N){
string ans;
n=N;
string pp, x;
for (int i=0;i<n;i++){
if (i==0){
pp="AB";
if (press(pp)>0){
pp="A";
if (press(pp)>0){
ans="A";
x="BXY";
}
else{
ans="B";
x="AXY";
}
continue;
}
pp="X";
if (press(pp)>0){
ans="X";
x="ABY";
}
else{
ans="Y";
x="ABX";
}
pp.clear();
continue;
}
if (n==1)return ans;
if (i==n-1){
pp=ans+x[0];
if (press(pp)==n){
ans+=x[0];
return ans;
}
pp=ans+x[1];
if (press(pp)==n){
ans+=x[1];
return ans;
}
ans+=x[2];
return ans;
}
pp.clear();
for (int q=0;q<4;q++){
pp+=ans;
if (q==3){
pp+=x[0];
for (int j=ans.size()+1;j<n;j++)pp+=ans[0];
break;
}
pp+=x[1];
pp+=x[q];
for (int j=ans.size()+2;j<n;j++)pp+=ans[0];
}
int y=press(pp);
if (y==ans.size())ans+=x[2];
if (y==ans.size()+1)ans+=x[0];
if (y==ans.size()+2)ans+=x[1];
pp.clear();
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |