이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "combo.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define st first
#define nd second
typedef long long ll;
typedef long double ld;
const ll I = 1000LL * 1000LL * 1000LL * 1000LL * 1000LL * 1000LL;
const ll M = 1000LL * 1000LL * 1000LL + 7LL;
string ans;
vector<string> hl;
string guess_sequence(int N)
{
int n = N, m = 1;
if(n == 1)
{
if(press("A")) return "A";
if(press("B")) return "B";
if(press("X")) return "X";
return "Y";
}
if(press("AB"))
{
if(press("A")) ans.pb('A');
else ans.pb('B');
}else
{
if(press("X")) ans.pb('X');
else ans.pb('Y');
}
if('A' != ans[0]) hl.pb("A");
if('B' != ans[0]) hl.pb("B");
if('X' != ans[0]) hl.pb("X");
if('Y' != ans[0]) hl.pb("Y");
while((int)ans.size() < n - 1)
{
string gs; int a;
gs = ans + hl[0] + ans + hl[1] + hl[0] + ans + hl[1] + hl[1] + ans + hl[1] + hl[2];
a = press(gs);
if(a == m) ans += hl[2];
if(a == m + 1) ans += hl[0];
if(a == m + 2) ans += hl[1];
++m;
}
//cout << ans << "\n";
string gs = ans + hl[0];
if(press(gs) == m + 1)
ans += hl[0];
else
{
gs = ans + hl[1];
if(press(gs) == m + 1)
ans += hl[1];
else
ans += hl[2];
}
//cout << ans << "\n";
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |