This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/**
* author: Mohamad Milhem
* created: 2020-04-06-22.53.40
**/
#include <bits/stdc++.h>
#include <stdio.h>
#include "combo.h"
using namespace std;
typedef long long ll;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define MOD ll(1000000007)
#define debug(x) cout << '[' << #x << " is: " << x << "] " <<endl;
#define decimalpoint cout << std::fixed << setprecision(5)
std::string guess_sequence(int N) {
string First = "ABXY";
int indx = -1;
for (int i = 0 ; i < 3 ; i++){
string here = "";
here+=First[i];
if (press(here) > 0){indx = i ; break;}
}
if (indx == -1)indx = 3;
vector<char> rest;
for (int i = 0 ; i < 4 ; i++){
if (i != indx)rest.push_back(First[i]);
}
string now = "" ;
now+=First[indx];
for (int i = 0 ; i < N - 2; i++){
string q = "";
string first = now + rest[1];
string second1 = now + rest[2] + rest[0] + now + rest[2] + rest[1] + now + rest[2] + rest[2];
q+=first;
q+=second1;
int ans = press(q);
int in = ans-now.size();
now+= rest[in];
}
string here1 = now + rest[0];
string here2 = now + rest[1];
if (press(here1) == N)now+= rest[0];
else if (press(here2) == N)now+= rest[1];
else now+=rest[2];
return now;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |