#include<bits/stdc++.h>
#define pi 3.141592653589793238
#include "combo.h"
#define MOD 1000000007
#define INF 999999999999999999
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
string guess_sequence(int n){
int i;
string ans = "";
vector<char> c = {'A', 'B', 'X', 'Y'};
if(press("AB")){
c.clear();
if(press("A")){
c = {'B', 'X', 'Y'};
ans = "A";
}
else{
ans = "B";
c = {'A', 'X', 'Y'};
}
}
else{
if(press("X")){
c = {'A', 'B', 'Y'};
ans = "X";
}
else{
ans = "Y";
c = {'A', 'B', 'X'};
}
}
//cout << c.size() << endl;
//cout << "# " << c[0] << c[1] << c[2] << c[3] << endl;
if(n == 1){
return ans;
}
for(i = 1; i < n - 1; i++){
string aa, bb, cc, dd;
aa = ans + c[0];
bb = ans + c[1] + c[1];
cc = ans + c[1] + c[2];
dd = ans + c[1] + c[0];
int val = press(aa + bb + cc + dd) - i;
cout << "# " << val << endl;
if(val == 1){
ans += c[0];
}
else if(val == 2){
ans += c[1];
}
else if(val == 0){
ans += c[2];
}
}
if(press(ans + c[0]) == n){
ans += c[0];
}
else if(press(ans + c[1]) == n){
ans += c[1];
}
else{
ans += c[2];
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
200 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
200 KB |
Output is correct |
6 |
Correct |
1 ms |
200 KB |
Output is correct |
7 |
Correct |
0 ms |
200 KB |
Output is correct |
8 |
Correct |
2 ms |
200 KB |
Output is correct |
9 |
Correct |
1 ms |
200 KB |
Output is correct |
10 |
Correct |
1 ms |
200 KB |
Output is correct |
11 |
Correct |
1 ms |
200 KB |
Output is correct |
12 |
Correct |
1 ms |
200 KB |
Output is correct |
13 |
Correct |
1 ms |
200 KB |
Output is correct |
14 |
Correct |
0 ms |
200 KB |
Output is correct |
15 |
Correct |
2 ms |
200 KB |
Output is correct |
16 |
Correct |
1 ms |
200 KB |
Output is correct |
17 |
Runtime error |
1 ms |
200 KB |
Execution failed because the return code was nonzero |
18 |
Halted |
0 ms |
0 KB |
- |