# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
505991 | LouayFarah | Combo (IOI18_combo) | C++14 | 102 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 "bits/stdc++.h"
using namespace std;
#define endl "\n"
#define ll long long int
#define pb push_back
#define mp make_pair
#define fi first
#define se second
const long long MOD = 1e9+7;
const long long INF = 1e18;
int nx[4] = {0, 0, -1, 1};
int ny[4] = {1, -1, 0, 0};
ll my_rand(ll l, ll r)
{
srand(chrono::steady_clock::now().time_since_epoch().count());
ll len = r-l;
ll a = rand()%len;
ll b = rand()%len;
ll res = ((((a%len)*((RAND_MAX+1)%len))%len) + (b%len))%len;
if(res<l)
res +=l;
return res;
}
int press(string p);
string guess_sequence(int n)
{
string s = "";
string choices = "ABXY";
string p = "";
for(int i = 0; i<4; i++)
{
p.pb(choices[i]);
if(press(p)==1)
{
s = p;
break;
}
p = s;
}
while(int(s.length())<n)
{
for(int i = 0; i<4; i++)
{
if(choices[i]==s[0])
continue;
if(choices[i]==s[int(s.length())-1])
continue;
p = s;
while(int(p.length())<4*n)
{
p.pb(choices[i]);
}
ll added = press(p) - int(s.length());
for(int j = 0; j<added; j++)
s.pb(choices[i]);
}
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |