# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
471588 | Cross_Ratio | Combo (IOI18_combo) | C++14 | 42 ms | 548 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>
//#include "combo.h"
using namespace std;
int press(string);
string guess_sequence(int N) {
int isA = press("AB");
string st;
char c;
if(isA) {
int isB = press("B");
if(isB) st = "B";
else st = "A";
}
else {
int isD = press("X");
if(isD) st = "X";
else st = "Y";
}
c = st[0];
char x, y, z;
char C[3];
int cnt = 0;
set<char> S;
S.insert('A');
S.insert('B');
S.insert('X');
S.insert('Y');
S.erase(c);
for(set<char>::iterator iter = S.begin();iter != S.end();iter++) {
C[cnt++] = *iter;
}
x = C[0];
y = C[1];
z = C[2];
while(st.length() < N) {
if(st.length() != N - 1) {
string s1 = st + x + x + st + x + y + st + y + x;
int k = press(s1) - st.length();
if(k == 0) {
st = st + z;
}
else if(k == 1) {
string s2 = st + y + y;
int k2 = press(s2) - st.length();
if(k2 == 0) {
st = st + x + z;
}
else if(k2 == 1) {
st = st + y + z;
}
else st = st + y + y;
}
else {
string s2 = st + x + x;
int k3 = press(s2) - st.length();
if(k3 == 0) {
st = st + y + x;
}
else if(k3 == 1) {
st = st + x + y;
}
else st = st + x + x;
}
}
else {
string s2 = st + x + st + y;
int k2 = press(s2) - st.length();
if(k2 == 0) st = st + z;
else {
string s3 = st + x;
int k3 = press(s3) - st.length();
if(k3 == 0) st = st + y;
else st = st + x;
}
}
}
return st;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |