# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
646098 | sandry24 | Combo (IOI18_combo) | C++17 | 45 ms | 560 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;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
int press(std::string p);
vector<char> chars = {'A', 'B', 'X', 'Y'};
string guess_sequence(int n){
string temp = "";
while(temp.size() != n){
if(temp.size() == 0){
int ans = press("AB");
if(ans > 0){
if(press("A"))
temp += "A";
else temp += "B";
} else {
if(press("X"))
temp += "X";
else temp += "Y";
}
chars.erase(find(chars.begin(), chars.end(), temp[0]));
} else if(temp.size() < n-1){
string temp2 = temp + chars[1] + temp + chars[2] + chars[0] + temp + chars[2] + chars[1]
+ temp + chars[2] + chars[2];
int ans = press(temp2) - temp.size();
temp += chars[ans];
} else {
int ans = 2;
if(press(temp + chars[0]) == n)
ans = 0;
else if(press(temp + chars[1]) == n)
ans = 1;
temp += chars[ans];
}
}
return temp;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |