# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
766889 | canadavid1 | Combo (IOI18_combo) | C++14 | 32 ms | 608 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"
using namespace std;
#define pb push_back
int press_internal(string p)
{
//cout << p << "\n";
return press(p);
}
string guess_sequence(int N)
{
mt19937 rng(12345);
string answer = "";
string letters = "";
int a = (press_internal("XY")>0)*2 + (press_internal("BY")>0);
char first_letter = "ABXY"[a];
for(auto i : "ABXY") if (i!=first_letter) letters.pb(i);
answer.pb(first_letter);
while(answer.size() < N-1)
{
string query = "";
query += answer;
query.pb(letters[1]);
for(int i = 0; i < 3; i++)
{
query += answer;
query.pb(letters[2]); query.pb(letters[i]);
}
answer.pb(letters[press_internal(query)-answer.size()]);
}
if (N == 1) return answer;
answer.pb(letters[0]);
if(press_internal(answer)==N) return answer;
answer.pop_back();
answer.pb(letters[1]);
if(press_internal(answer)==N) return answer;
answer.pop_back();
answer.pb(letters[2]);
return answer;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |