# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
750904 | KN200711 | Combo (IOI18_combo) | C++14 | 1 ms | 208 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;
string guess_sequence(int N) {
string A = "AB";
string ans;
if(press(A)) {
A = "A";
if(press(A)) ans = A;
else ans = "B";
} else {
A = "X";
if(press(A)) ans = A;
else ans = "Y";
}
vector<string> p;
p.clear();
if(ans != "A") p.push_back("A");
if(ans != "B") p.push_back("B");
if(ans != "X") p.push_back("X");
if(ans != "Y") p.push_back("Y");
// cout<<ans<<endl;
// for(int d=0;d<p.size();d++) cout<<p[d]<<endl;
for(int i=1;i<=N-2;i++) {
string cek;
cek = ans;
cek += p[0];
for(int d=0;d<p.size();d++) {
cek += ans;
cek += p[1];
cek += p[d];
}
int V = press(cek);
// cout<<V<<endl;
if(V == ans.length()) ans += p[2];
else if(V == ans.length() + 1) ans += p[0];
else ans += p[1];
// cout<<ans<<endl;
}
string cek = ans;
cek += "A";
cek += ans;
cek += "B";
// cout<<press(cek)<<endl;
if(press(cek) == N) {
cek = ans;
cek += "A";
if(press(cek) == N) ans += "A";
else ans += "B";
} else {
cek = ans;
cek += "X";
if(press(cek) == N) 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... |