# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1014750 | MrPavlito | Combo (IOI18_combo) | C++17 | 24 ms | 1944 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"
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define sc second
#define endl "\n"
#define pii pair<int,int>
using namespace std;
std::string guess_sequence(int N) {
string rez = "";
vector<string> slova;
if(press("AB") > 0)
{
if(press("A") == 1)
{
rez = "A";
slova.pb("B");
slova.pb("X");
slova.pb("Y");
}
else
{
rez = "B";
slova.pb("A");
slova.pb("X");
slova.pb("Y");
}
}
else
{
if(press("X") == 1)
{
rez = "X";
slova.pb("B");
slova.pb("A");
slova.pb("Y");
}
else
{
rez = "Y";
slova.pb("B");
slova.pb("X");
slova.pb("A");
}
}
if(N==1)return rez;
for(int i=0; i<N-2; i++)
{
string guess = rez+slova[0]+slova[0]+rez+slova[0]+slova[1]+rez+slova[0]+slova[2]+rez+slova[1];
int p = press(guess);
if(p == rez.size()+2)rez+=slova[0];
else if(p == rez.size()+1)rez+=slova[1];
else rez+=slova[2];
}
if(press(rez+slova[0]) == N)return rez+slova[0];
else if(press(rez+slova[1]) == N)return rez+slova[1];
else return rez+slova[2];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |