이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define F first
#define S second
#define pb push_back
#include "combo.h"
using namespace std;
constexpr int debug = 0;
string guess_sequence(int n){
vector<char> usable;
string curr = "";
int a1 = press("AB");
if(a1){
a1 = press("AXAY");
(a1 >= 1) ? curr = "A" : curr = "B";
}
else{
a1 = press("XAXB");
(a1 >= 1) ? curr = "X" : curr = "Y";
}
vector<char> all = {'A', 'B', 'X', 'Y'};
for(auto k: all){
if(k != curr[0]) usable.pb(k);
}
string tochek = "";
for(int i = 2; i < n; i++){ //iteracja po dlugosci
tochek = curr + usable[0];
for(int j = 0; j < 3; j++) tochek += (curr + usable[1] + usable[j]);
a1 = press(tochek);
if(a1-curr.size() == 2) curr += usable[1];
else if(a1-curr.size()) curr += usable[0];
else curr += usable[2];
}
if(n >= 2){
tochek = curr + usable[0] + curr + usable[1];
a1 = press(tochek)-curr.size();
tochek = curr + usable[1] + curr + usable[2];
int a2 = press(tochek)-curr.size();
if(a1 && a2) curr += usable[1];
else if(a1) curr += usable[0];
else curr += usable[2];
}
return curr;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |