이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>
#include "combo.h"
map<ll, char>mp;
string guess_sequence(int N) {
mp[0] = 'A'; mp[1] = 'B'; mp[2] = 'X'; mp[3] = 'Y';
string ans;
ll p;
vector<ll>list;
//先頭文字決めるよ(*'ω'*)
if (press("AB") >= 1) {
if (press("A") == 1)p = 0;
else p = 1;
}
else {
if (press("X") == 1)p = 2;
else p = 3;
}
ans.push_back(mp[p]);
REP(i, 4) {
if (i != p)list.push_back(i);
}
//最後の文字以外を決めるよ(*'ω'*)(*'ω'*)
FOR(i, 1, N - 1) {
string now;
REP(j, 3) {
now += ans;
now.push_back(mp[list[0]]);
now.push_back(mp[list[j]]);
}
now += ans;
now.push_back(mp[list[1]]);
ll res = press(now);
if (res == i + 2)ans.push_back(mp[list[0]]);
else if (res == i + 1)ans.push_back(mp[list[1]]);
else ans.push_back(mp[list[2]]);
}
//最後の文字決めるよ(*'ω'*)(*'ω'*)(*'ω'*)
string aa = ans, bb = ans;
ll a, b;
aa.push_back(mp[list[0]]);
bb.push_back(mp[list[1]]);
aa += ans;
bb += ans;
aa.push_back(mp[list[1]]);
bb.push_back(mp[list[2]]);
a = press(aa);
b = press(bb);
if (a == N and b == N - 1)ans.push_back(mp[list[0]]);
else if (a == N and b == N)ans.push_back(mp[list[1]]);
else ans.push_back(mp[list[2]]);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |