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;
string guess_sequence(int N){
// 30 points
// get first character;
string f = string(N,' ');
f[0] = 'Y';
string chs = "ABX";
for(char c: chs){
string s = string(1,c);
if(press(s)){
f[0] = c;
break;
}
}
// check 1 - n - 1 only three 2 character
string chk = "";
for(char c: "ABXY") if(c != f[0]){
chk += c;
}
for(int i = 1; i < N; i++){
for(int j = 0; j < 2; j++){
string s = f.substr(0,i) + chk[j];
if(press(s) == i + 1){
f[i] = chk[j];
break;
}
}
if(f[i] == ' ') f[i] = chk[2];
}
cout << f;
return f;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |