# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1114949 | slumio | Combo (IOI18_combo) | C++17 | 54 ms | 2128 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;
using ll = long long int;
using ull = unsigned long long;
/*I liked you once but not anymore now
She's wearin' dresses on the border line
(Lookin' good)
Oh wakin' senses that were lost in time
(Make amends)
This liberation is the one they'll love for ages
(Hey man, I see them comin')*/
string guess_sequence(int n)
{
string ans = "";
string s = "";
string p;
if (press("AB"))
{
if (press("A"))
ans = "A", s = "BXY";
else
ans = "B", s = "AXY";
}
else
{
if (press("X"))
ans = "X", s = "ABY";
else
ans = "Y", s = "AXB";
}
for (int i = 1; i < n - 1; i++)
{
p = ans + s[0] + s[1] + ans + s[0] + s[2] + ans + s[0] + s[0] + ans + s[1];
int mp = press(p);
if (mp == ans.size() + 2)
{
ans.push_back(s[0]);
}
else if (mp == ans.size() + 1)
{
ans.push_back(s[1]);
}
else
ans.push_back(s[2]);
}
if (ans.size() < n)
{
p = ans + s[0];
if (press(p) == n)
{
ans.push_back(s[0]);
return ans;
}
p = ans + s[1];
if (press(p) == n)
{
ans.push_back(s[1]);
return ans;
}
ans.push_back(s[2]);
return ans;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |