이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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{
c.clear();
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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |