# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
297691 | Leonardo16 | Combo (IOI18_combo) | C++14 | 0 ms | 200 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"
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii >
#define fst first
#define scd second
#define sz size
#define pb push_back
#define fl '\n'
#define el endl
#define all(x) x.begin(),x.end()
string guess_sequence(int n) {
char beg='A';
if(press("B")==1){
beg='B';
}else{
if(press("XY")>=1){
if( press("X")==1 ){
beg='X';
}else{
beg='Y';
}
}
}
map<char,int>mp;
mp['A']++;
mp['B']++;
mp['X']++;
mp['Y']++;
mp.erase(beg);
vector<char>v;
for(auto it:mp){
v.pb(it.fst);
}
string ret;
ret+=beg;
cout<<v[0]<<" "<<v[1]<<" "<<v[2]<<fl;
for(int i=2;i<=n;i++){
string ask;
for(int j=0;j<ret.sz();j++){
ask+=ret[j];
}
ask+=v[0];
if(i!=n){
for(int j=0;j<ret.sz();j++){
ask+=ret[j];
}
ask+=v[1];
ask+=v[0];
for(int j=0;j<ret.sz();j++){
ask+=ret[j];
}
ask+=v[1];
ask+=v[1];
for(int j=0;j<ret.sz();j++){
ask+=ret[j];
}
ask+=v[1];
ask+=v[2];
}else{
string ask;
for(int j=0;j<ret.sz();j++){
ask+=ret[j];
}
if(press(ask+v[0])==n){
ret+=v[0];
}else{
if(press(ask+v[1])==n){
ret+=v[1];
}else{
ret+=v[2];
}
}
break;
}
int x=press(ask);
if(x==i){
ret+=v[0];
}else{
if(x==i+1){
ret+=v[1];
}else{
ret+=v[2];
}
}
cout<<ask<<" "<<x<<fl;
cout<<ret<<fl;
}
return ret;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |