# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
436403 | stoyan_malinin | Combo (IOI18_combo) | C++14 | 67 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 <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include "combo.h"
#ifdef __LOCAL
#include "grader.cpp"
#endif // __LOCAL
using namespace std;
char extend(string &ans)
{
vector <char> options = {'A', 'B', 'X', 'Y'};
if(ans.size()!=0)
options.erase(find(options.begin(), options.end(), ans[0]));
if(ans.size()==0)
{
if(press("AB")>=1)
{
if(press("A")>=1) return 'A';
return 'B';
}
else
{
if(press("X")>=1) return 'X';
return 'Y';
}
}
else
{
int res = press(ans+options[0]+ans+options[1]);
if(res==ans.size()) return options[2];
res = press(ans+options[0]);
if(res==ans.size()) return options[1];
return options[0];
}
}
string guess_sequence(int N)
{
string ans = "";
for(int i = 0;i<N;i++) ans += extend(ans);
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |