# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
447543 | MohamedAliSaidane | Combo (IOI18_combo) | C++14 | 34 ms | 360 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;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define pb push_back
#define popb pop_back
#define ff first
#define ss second
const int MOD = 1e9 + 7;
const ll INF = 1e18;
string guess_sequence(int n)
{
char but[4] = {'A','B','X','Y'};
string p = "";
string s = "";
int fr = -1;
for(int i = 0; i < 4; i ++)
{
string g = but[i]+p;
int rep = press(g);
if(rep == 1)
{
fr = i;
s = but[i]+p;
break;
}
}
but[fr] = 'Y';
string first = but[0] + "";
string second = "" + but[1] + but[0];
string third = "" + but[1] + but[1];
string fourth = "" + but[1] + but[2];
while(s.length() < n -1)
{
string g = s + first + s + second + s + third + s + fourth;
int tent = press(g);
if(tent == s.length() +1)
{
s += but[0] ;
}
else if(tent == s.length() + 2)
{
s += but[1];
}
else
{
s += but[2];
}
}
if(n != 1)
{
if(press(s+but[0]) == n)
s += but[0];
else if(press(s+but[1]) == n)
s += but[1];
else s += but[2];
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |