# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
713237 | ooo | Combo (IOI18_combo) | C++14 | 30 ms | 540 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 <bits/stdc++.h>
using namespace std;
string guess_sequence(int n)
{
string s = "";
if(press("AB"))
{
if(press("A")) s += 'A';
else s += 'B';
}
else
{
if(press("X")) s += 'X';
else s += 'Y';
}
string thua = "";
if(s[0] != 'A') thua += 'A';
if(s[0] != 'B') thua += 'B';
if(s[0] != 'X') thua += 'X';
if(s[0] != 'Y') thua += 'Y';
int len = int(s.size());
while(len < n-1)
{
string temp = s+thua[0]+s+thua[1]+thua[0]+s+thua[1]+thua[2]+s+thua[1]+thua[1];
int x = press(temp);
if(x == len) s += thua[2];
else if(x == len+1) s += thua[0];
else s += thua[1];
len = int(s.size());
}
if(len == n) return s;
if(press(s+thua[0]) == n) return s+thua[0];
if(press(s+thua[1]) == n) return s+thua[1];
if(press(s+thua[2]) == n) return s+thua[2];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |