# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
228384 | hhh07 | Combo (IOI18_combo) | C++14 | 1 ms | 200 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 <string>
#include <algorithm>
#include "combo.h"
using namespace std;
string guess_sequence(int n){
string curr = "";
char x[4];
x[0] = 'A'; x[1] = 'B'; x[2] = 'X'; x[3] = 'Y';
while(curr.length() < n){
if (curr.length() == n - 1){
if (press(curr + x[0]) == n)
return curr + x[0];
if (press(curr + x[1]) == n)
return curr + x[1];
return curr + x[2];
}
if (curr.length() == 0){
if (press("AB") > 0){
if (press("A") > 0)
curr += 'A';
else
curr += 'B';
}
else{
if (press("X") > 0)
curr += 'X';
else
curr += 'Y';
}
for (int i = 0; i < 4; i++)
if (curr[0] == x[i])
x[i] = 'Z';
sort(x, x + 4);
}
else{
string s = "";
for (int i = 0; i < 3; i++)
s += curr + x[0] + x[i];
s += curr + x[1] + x[3];
if (press(s) >= 2)
curr += x[0];
else if (press(s) >= 1)
curr += x[1];
else
curr += x[2];
}
}
return curr;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |