# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
1265810 | | WH8 | 콤보 (IOI18_combo) | C++20 | | 8 ms | 484 KiB |
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N) {
vector<char> opt={'A', 'B', 'X', 'Y'};
string p = "";
if(press("AB")){
if(press("A")){
p+='A';
}
else{
p+='B';
}
}
else {
if(press("X")){
p+='X';
}
else {
p+='Y';
}
}
//~ cout<<"p[0] is " << p[0]<<endl;
opt.erase(find(opt.begin(),opt.end(),p[0]));
//~ for(auto it:opt){
//~ cout<<it<<endl;
//~ }
for(int i=2;i<N;i++){
string send=p+opt[0]+p+opt[1]+opt[0]+p+opt[1]+opt[1]+p+opt[1]+opt[2];
//~ cout<<send<<endl;
int ret=press(send);
if(ret==(int)p.size()){
p+=opt[2];
}
else if(ret==(int)p.size()+1){
p+=opt[0];
}
else{
p+=opt[1];
}
}
if(N==1){
}
else if(press(p+opt[0]) == N){
p+=opt[0];
}
else if(press(p+opt[1])==N){
p+=opt[1];
}
else {
p+=opt[2];
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |