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"
#define MASK(i) (1ll << (i))
#define BIT(x, i) (((x) >> (i)) & 1)
#define REP(i, a, b) for(int i = (a), _b = (b); i <= _b; ++i)
#define REPD(i, a, b) for(int i = (a), _b = (b); i >= _b; --i)
#define ALL(v) (v).begin(), (v).end()
#define SZ(v) (int)(v).size()
#define PATHWA "A"
#define fi first
#define se second
#define ll long long
using namespace std;
/*
int press(string p) {
const string S = "ABXYY";
int res = 0;
REP(l, 1, SZ(S)) {
REP(i, 0, SZ(p) - l) {
if(S.substr(0, l) == p.substr(i, l)) {
res = l;
break;
}
}
}
return res;
}
*/
string guess_sequence(int N) {
vector<char> a = {'A', 'B', 'X', 'Y'};
string res, tmp;
REP(i, 0, 2) {
tmp.push_back(a[i]);
if(press(tmp) == 1) {
res.push_back(a[i]);
break;
}
tmp.pop_back();
}
if(res.empty()) {
res.push_back(a[3]);
tmp.push_back(a[3]);
}
vector<char> b;
REP(i, 0, 3) if(res[0] != a[i]) b.push_back(a[i]);
tmp = res;
REP(l, 2, N) {
REP(i, 0, 1) {
tmp.push_back(b[i]);
if(press(tmp) == l) {
res.push_back(b[i]);
break;
}
tmp.pop_back();
}
if(SZ(res) < l) {
res.push_back(b[2]);
tmp.push_back(b[2]);
}
}
return res;
}
/*
int main(void) {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
if(fopen(PATHWA".INP", "r")) {
freopen(PATHWA".INP", "r", stdin);
freopen(PATHWA".OUT", "w", stdout);
}
return 0;
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |