# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
648868 | Litusiano | Combo (IOI18_combo) | C++14 | 29 ms | 496 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 <cstdlib>
#include <algorithm>
#include <string>
#include "combo.h"
using namespace std;
string guess_sequence(int N){
string ans;
int x = 1;
if(press("AB") > 0){
if(press("A")){
ans+='A';
x = 0;
}
else ans+='B';
}
else{
if(press("X")){
ans+='X';
x = 2;
}
else{
ans+='Y';
x = 3;
}
}
string all = "ABXY";
string pos;
for(int i = 0; i<all.size(); ++i){
if(i == x) continue;
pos+=all[i];
}
/*
Faig una sola opcio amb 0
dos opcions amb 1
cap amb 2
*/
for(int i = 2; i<=N-2; ++i){
string s0 = ans+pos[0];
string s1 = ans+pos[1]+pos[0],s2 = ans+pos[1]+pos[1],s3 = ans+pos[1]+pos[2];
string tot = s0+s1+s2+s3;
//cout<<4*N<<" "<<tot.size()<<endl;
int c = press(s0+s1+s2+s3);
ans+=pos[(c-i)];
}
for(int i = max(2,N-1); i<=N; ++i){
string tot = ans; tot+="A";
tot+=ans; tot+="B";
//cout<<tot<<" "<<press(tot)<<endl;
if(press(tot) >= i){
tot.pop_back();
if(press(tot) >= i) ans+="A";
else ans+="B";
}
else{
tot = ans;
tot+='X';
if(press(tot) >= i) ans+="X";
else ans+='Y';
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |