This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//記得跳題
// #pragma GCC optimize("O3,unroll_loops")
// #pragma GCC target("avx2")
#include<iostream>
#include<array>
#include<vector>
#include<string>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<iomanip>
#include<bitset>
#include<tuple>
#include<random>
using namespace std;
#define ll long long
#define DB double
#define LL __int128_t
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>=b;i--)
#define INF (ll)(2e9)
#define F first
#define S second
#define X first
#define Y second
#define eps (DB)(1e-10)
#define pb push_back
#define mp make_pair
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#include "combo.h"
//string ans;
/*int press(string p) {
REP(i, (int)ans.size(), 1) {
string tmp = ans.substr(0, i);
if (p.find(tmp) != p.npos) return i;
}
return 0;
}*/
char c[4] = {'A', 'B', 'X', 'Y'};
string guess_sequence(int n) {
string s, out;
int fir = -1, p;
FOR(i, 0, n) {
int cnt = 0;
FOR(j, 0, 4) if (j != fir) {
cnt++;
out += c[j];
if (i && cnt == 3) break;
if (!i && cnt == 4) break;
p = press(out);
// cout << "i = " << i << " out = " << out << " p = " << p << endl;
if (p == i + 1) {
if (!i) fir = j;
break;
}
out.pop_back();
//if (cnt == 2) break;
}
// cout << "out = " << out << endl;
}
return out;
}
/*signed main() {
AC;
// go
int t; cin >> t;
while (t--) {
string n; cin >> n;
ans = n;
cout << guess_sequence((int)n.size()) << endl;
}
}*/
/*
????????????????????????????????????????????????
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |