이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/**
* 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... |