# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
203650 | Tadiorn | Combo (IOI18_combo) | C++14 | 3 ms | 200 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;
/*int press(string lol)
{
cout << lol << ":\n";
int lollol;
cin >> lollol;
return lollol;
}*/
string guess_sequence(int N)
{
if(N == 1)
{
string f;
int te = press("AB");
if(te >= 1)
{
te = press("A");
if(te == 1)
{
return "A";
}
else
{
return "B";
}
}
else
{
te = press("X");
if(te == 1)
{
return "X";
}
else
{
return "Y";
}
}
}
else
{
string f;
int te = press("AB");
if(te >= 1)
{
te = press("A");
if(te == 1)
{
f = "A";
}
else
{
f = "B";
}
}
else
{
te = press("X");
if(te == 1)
{
f = "X";
}
else
{
f = "Y";
}
}
if(f == "A")
{
for(int i = 1; i < N - 1; i++)
{
int t = press(f + "X"+ f + "YB" + f + "YX" + f + "YY");
if(t == (int)f.size())
{
f += "B";
}
else if(t == (int)f.size() + 1)
{
f += "X";
}
else //if(t == s.size() + 2)
{
f += "Y";
}
}
}
else if(f == "B")
{
int t = press(f + "X"+ f + "YA" + f + "YX" + f + "YY");
if(t == (int)f.size())
{
f += "A";
}
else if(t == (int)f.size() + 1)
{
f += "X";
}
else //if(t == s.size() + 2)
{
f += "Y";
}
}
else if(f == "X")
{
int t = press(f + "A"+ f + "BA" + f + "BB" + f + "BY");
if(t == (int)f.size())
{
f += "Y";
}
else if(t == (int)f.size() + 1)
{
f += "A";
}
else //if(t == s.size() + 2)
{
f += "B";
}
}
else //if(f == "Y")
{
int t = press(f + "A"+ f + "BA" + f + "BB" + f + "BX");
if(t == (int)f.size())
{
f += "X";
}
else if(t == (int)f.size() + 1)
{
f += "A";
}
else //if(t == s.size() + 2)
{
f += "B";
}
}
te = press(f + "A" + f + "B");
if(te >= N)
{
te = press(f + "A");
if(te == N)
{
f += "A";
}
else
{
f += "B";
}
}
else
{
te = press(f + "X");
if(te == N)
{
f += "X";
}
else
{
f += "Y";
}
}
return f;
}
}
/*int main()
{
int n;
cin >> n;
string rez = guess_sequence(n);
cout << rez << "\n";
return 0;
}*/
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |