# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
185346 | oofsauce | Combo (IOI18_combo) | C++14 | 2 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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N) {
string search = "ABXY";
int idx = 0;
if(press("AB") == 0) idx = 2;
string t = "";
t.push_back(search[idx]);
if(press(t) == 0) idx ++;
// cout << t << endl;
// cout << search[idx];
string X = "";
X.push_back(search[idx]);
if(N == 1) return X;
string ss = "";
for(char c: search)
if(c != search[idx])
ss.push_back(c);
while(X.size() < N-1) {
// string query = "";
// cout << (X+ss[1]) + (X+ss[2]+ss[0]) + (X+ss[2]+ss[1]) + (X+ss[2]+ss[2]) << endl;
int c = press((X+ss[1]) + (X+ss[2]+ss[0]) + (X+ss[2]+ss[1]) + (X+ss[2]+ss[2]) );
X += ss[c-(X.size())];
}
idx = 0;
if(press(X+"AB") == N-1) idx = 2;
if(press(X + search[idx]) == N-1) idx ++;
X.push_back(search[idx]);
// cout << X;
// int coins = press(p);
return X;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |