# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
305035 | mihai145 | Combo (IOI18_combo) | C++14 | 56 ms | 432 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 "combo.h"
#include <vector>
#include <set>
std::string guess_sequence(int N)
{
std::string s = "";
///first letter logic
int coins = press("AB");
if(coins == 0)
{
///first letter is X or Y
coins = press("X");
if(coins == 0)
s += "Y";
else
s += "X";
}
else
{
///first letter is A or B
coins = press("A");
if(coins == 0)
s += "B";
else
s += "A";
}
std::set <char> opts;
opts.insert('A');
opts.insert('B');
opts.insert('X');
opts.insert('Y');
opts.erase(s[0]);
std::vector <char> optv;
for(auto it : opts)
optv.push_back(it);
for(int pos = 2; pos <= N; pos++)
{
coins = press(s + optv[0] + s + optv[1]);
if(coins == s.size())
s += optv[2];
else
{
coins = press(s + optv[0]);
if(coins == s.size())
s += optv[1];
else
s += optv[0];
}
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |