# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
107285 | kyunamk | Combo (IOI18_combo) | C++14 | 40 ms | 740 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 <iostream>
using namespace std;
static int debug = false;
string guess_sequence(int N) {
string p = "";
char *b;
string prefix ="";
if ( press("AB") )
{
//AB
if (press("A") ) {
prefix = "A";
b="BXY";
}
else
{
prefix = "B";
b="AXY";
}
}
else
{
//AB
if (press("X") )
{
prefix = "X";
b="ABY";
}
else
{
prefix = "Y";
b="ABX";
}
}
if(debug) cout << b[0] << b[1] << b[2] << endl;
int pn ;
while ( (pn=prefix.length()) < N-1 ) {
int i = 0 ;
int n = 0;
string append = prefix;
append = prefix;
string s ="";
s+=prefix;
s+=b[1];
for ( i = 0 ; i < 3 ; i++) {
s+=prefix;
s+=b[2];
s+=b[i];
}
if(debug) cout << s << " ";
n = press(s) ;
if(debug) cout << n << endl;
prefix += b[n-pn];
if(debug) cout << "prefix " << prefix << endl;
}
if ( N > 1) {
if ( press(prefix + b[0] + prefix + b[1]) == N ) {
if ( press(prefix + b[0]) == N )
prefix.append(1,b[0]);
else
prefix.append(1,b[1]);
} else
{
prefix.append(1,b[2]);
}
}
if(debug) cout << prefix << endl;
return prefix;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |