# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
489459 | QuantumK9 | Combo (IOI18_combo) | C++17 | 31 ms | 604 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) {
// guess the first letter: this will take at MOST two moves
string start = "";
int coins = press("AB");
if ( coins > 0 ){
coins = press("A");
if ( coins > 0 ){ start = "A"; }
else{ start = "B"; }
}
else{
coins = press("X");
if ( coins > 0 ){ start = "X"; }
else{ start = "Y"; }
}
if ( N == 1 ){ return start; }
// guess the succeeding letters --> current method needs two guesses / letter
string check[3];
int ind = 0;
if ( "A" != start ){ check[ind] = "A"; ind++; }
if ( "B" != start ){ check[ind] = "B"; ind++; }
if ( "X" != start ){ check[ind] = "X"; ind++; }
if ( "Y" != start ){ check[ind] = "Y"; ind++; }
for ( int i = 1; i < N-1; i++ ){
string use = start+check[0];
use += start+check[1]+check[0];
use += start+check[1]+check[1];
use += start+check[1]+check[2];
coins = press( use );
int diff = coins - start.length();
if ( diff == 0 ){ start += check[2]; }
else if ( diff == 1 ){ start += check[0]; }
else if ( diff == 2 ){ start += check[1]; }
}
coins = press( start+check[0] );
if ( coins == start.length()+1 ){ start += check[0]; }
else{
coins = press( start+check[1] );
if ( coins == start.length()+1 ){ start += check[1]; }
else{ start += check[2]; }
}
//cout << start << endl;
return start;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |