이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "combo.h"
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <bitset>
#include <string>
#include <fstream>
#include <cstring>
using namespace std;
#define ll long long
#define llu unsigned long long
#define ld long double
#define F first
#define S second
#define endl "\n"
#define MID ((l+r)/2)
#define sorv(a) sort(a.begin(),a.end())
#define revv(a) reverse(a.begin(),a.end())
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)(x).size()
#define ins insert
#define pb push_back
#define inf 1e9
#define INF 1e18
#define MOD 1000000007
#define MOD2 998244353
typedef pair <ll, ll> ii;
typedef pair <ll,ii> iii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <iii> viii;
typedef set <ll> si;
typedef map <ll,ll> mi;
string guess_sequence(int n) {
string p, s = "";
string w = "ABXY";
//find first letter (3 operations)
ll a = press("A"), b = press("B"), x = press("X");
ll f = 3;
if (a) f = 0;
else if (b) f = 1;
else if (x) f = 2;
s += w[f];
w.erase(w.begin() + f);
//find all letters until n-1 (n-2 operations)
for (ll i =1; i<n-1; i++){
p = s + w[0] + s + w[1] + w[0] + s + w[1] + w[1] + s + w[1] + w[2];
//dbg2(s,p);
x = press(p);
if (x == i) s += w[2];
else if (x == i+1) s += w[0];
else s += w[1];
}
//find last letter (2 operations)
a = press(s + w[0]), b = press(s + w[1]);
if (a == b) s += w[2];
else if (a > b) s += w[0];
else s += w[1];
//dbg(s);
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |