# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
116533 | Sorting | Combo (IOI18_combo) | C++14 | 61 ms | 688 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>
using namespace std;
int press(string p);
string guess_sequence(int n){
string curr = "";
if(press("XY")){
if(press("X")){
curr = "X";
}
else{
curr = "Y";
}
}
else{
if(press("A")){
curr = "A";
}
else{
curr = "B";
}
}
if(n == 1){
return curr;
}
vector<char> v;
v.push_back('A');
v.push_back('B');
v.push_back('X');
v.push_back('Y');
for(char &c: v){
if(c == curr[0]){
swap(c, v.back());
v.pop_back();
break;
}
}
for(int i = 1; i < n - 1; i++){
string q = curr + v[0] + v[0] + curr + v[0] + v[1] + curr + v[0] + v[2] + curr + v[1];
int ans = press(q);
if(ans == curr.size()){
curr += v[2];
continue;
}
if(ans == curr.size() + 1){
curr += v[1];
continue;
}
curr += v[0];
}
if(press(curr + v[0]) == n){
curr += v[0];
return curr;
}
if(press(curr + v[1]) == n){
curr += v[1];
return curr;
}
curr += v[2];
return curr;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |