# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
262128 | Rainbowbunny | Combo (IOI18_combo) | C++17 | 3 ms | 456 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;
map <char, char> M;
string guess_sequence(int n)
{
string ans;
M['A'] = 'A';
M['B'] = 'B';
M['X'] = 'X';
M['Y'] = 'Y';
int a = press("AX");
if(a > 0)
{
int b = press("A");
if(b > 0)
{
ans.push_back('A');
}
else
{
ans.push_back('X');
}
}
else
{
int b = press("Y");
if(b > 0)
{
ans.push_back('Y');
}
else
{
ans.push_back('B');
}
}
swap(M[ans[0]], M['Y']);
for(int i = 1; i < n; i++)
{
if(i == n - 1)
{
string temp = ans;
temp.push_back(M['A']);
int cnt = press(temp);
if(cnt == n)
{
return temp;
}
temp.back() = M['B'];
cnt = press(temp);
if(cnt == n)
{
return temp;
}
ans.push_back(M['X']);
return ans;
}
else
{
string temp;
temp = ans;
temp.push_back(M['A']);
temp.push_back(M['B']);
for(auto x : ans)
{
temp.push_back(x);
}
temp.push_back(M['A']);
temp.push_back(M['A']);
for(auto x : ans)
{
temp.push_back(x);
}
temp.push_back(M['A']);
temp.push_back(M['X']);
for(auto x : ans)
{
temp.push_back(x);
}
temp.push_back(M['B']);
int cnt = press(temp);
if(cnt == i)
{
ans.push_back(M['X']);
}
else if(cnt == i + 1)
{
ans.push_back(M['B']);
}
else
{
ans.push_back(M['A']);
}
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |