# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
648234 | _petar_b | Combo (IOI18_combo) | C++14 | 35 ms | 620 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>
#define MAXN 100010
#define pb push_back
#define ll long long
#define fi first
#define se second
#define mp make_pair
using namespace std;
std::string guess_sequence(int N) {
char c[4] = {'A', 'B', 'X', 'Y'};
int coins = press("AB");
std::string S = "";
if (coins >= 1)
{
coins = press("A");
if (coins == 1)
{
S += "A";
swap(c[0], c[3]);
}
else
{
S += "B";
swap(c[1], c[3]);
}
}
else
{
coins = press("X");
if (coins == 1)
{
S += "X";
swap(c[2], c[3]);
}
else
{
S += "Y";
}
}
while(S.size() < N-1)
{
std::string p = "";
//1
p += S;
p += c[0];
//2;
p += S;
p += c[1];
p += c[0];
//3
p += S;
p += c[1];
p += c[1];
//4
p += S;
p += c[1];
p += c[2];
coins = press(p);
if (coins == S.size())
S += c[2];
else if (coins == S.size() + 1)
S += c[0];
else
S += c[1];
}
if (N == 1)
return S;
string p = "";
p += S;
p += c[0];
coins = press(p);
if (coins == N)
{
S += c[0];
return S;
}
p = "";
p += S;
p += c[1];
coins = press(p);
if (coins == N)
{
S += c[1];
return S;
}
S += c[2];
return S;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |