# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
140248 | Runtime_error_ | Combo (IOI18_combo) | C++14 | 2 ms | 284 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) {
vector<char> v = {'A','B','X','Y'};
string ans = "";
if( press("AB") )
ans += ( press("A") ? 'A' : 'B' );
else
ans += ( press("X") ? 'X' : 'Y');
if(ans[0] == 'A')
v.erase( v.begin() + 0 );
else if(ans[0] == 'B')
v.erase( v.begin() + 1 );
else if(ans[0] == 'X')
v.erase( v.begin() + 2 );
else
v.erase( v.begin() + 3 );
for(int i=1;i<N-1;i++){
string tmp = ans+v[0] + ans+v[1]+v[0] + ans+v[1]+v[1] + ans+v[1]+v[2];
int res = press(tmp);
if( res == ans.size() )
ans += v[2];
else if( res == ans.size()+2 )
ans += v[1];
else
ans += v[0];
}
if( press( ans+v[0] ) == N )
ans += v[0];
else if( press( ans+v[1] ) == N)
ans += v[1];
else
ans += v[2];
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |