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 <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <random>
#include <stack>
#include <deque>
#include <chrono>
#include "combo.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef pair<int,int> pii;
#define REP(i, a, b) for (int i = int(a); i <= int(b); i++)
#define REPb(j, d, c) for (int j = int(d); j >= int(c); j--)
#define ff first
#define ss second
#define pb push_back
#define len(x) int((x).size())
string guess_sequence(int N)
{
int n=N;
string ans;
int ret1 = press("AB");
if(ret1>0)
{
int ret2=press("A");
if(ret2>0) ans+='A';
else ans+='B';
}
else
{
int ret2=press("X");
if(ret2>0) ans+='X';
else ans+='Y';
}
if(N==1) return ans;
vector<char> ALL = {'A','B','X','Y'};
vector<char> V;
REP(i,0,3)
{
if(ALL[i] != ans[0]) V.pb(ALL[i]);
}
REP(i,2,n-1)
{
string cur_press = ans+V[0]+ans+V[1]+V[0]+ans+V[1]+V[1]+ans+V[1]+V[2];
int ret3=press(cur_press);
if(ret3==i-1) ans+=V[2];
if(ret3==i) ans+=V[0];
if(ret3==i+1) ans+=V[1];
}
int ret4=press(ans+V[0]);
if(ret4==N) return ans+V[0];
int ret5=press(ans+V[1]);
if(ret5==N) return ans+V[1];
return ans+V[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |