이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#include "combo.h"
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, int> pli;
typedef pair <int, ll> pil;
typedef pair <ll, ll> pll;
typedef pair <ld, ld> pdd;
#define debug(x) cout << '[' << #x << ": " << x << "] "
#define cio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define cases int _; cin >> _; while(_--)
#define pb push_back
#define eb emplace_back
#define space << " " <<
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define Unique(v) v.erase(unique(all(v)), v.end())
#define mset(x) memset(x, 0, sizeof(x))
#define sflush fflush(stdout)
#define cflush cout.flush()
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define lyes cout << "Yes\n"
#define lno cout << "No\n"
#define nl cout << "\n";
#define binary(len, num) bitset <len> (num)
#define vt vector
#define ar array
#define Mat vt <vt <int> >
#define uid uniform_int_distribution
template <typename T> istream& operator >> (istream& in, vector<T>& a) {for(auto &x : a) in >> x; return in;};
template <typename T> ostream& operator << (ostream& out, vector<T>& a) {for(auto &x : a) out << x << ' '; return out;};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int read(){
int w = 1, c, ret;
while((c = getchar()) > '9' || c < '0'){
w = (c == '-' ? -1 : 1);
}
ret = c - '0';
while((c = getchar()) >= '0' && c <= '9'){
ret = ret * 10 + c - '0';
}
return ret * w;
}
int rd(){
int in;
cin >> in;
return in;
}
void write(int x){
if(x < 0){
putchar('-');
x = -x;
}
if(x > 9){
write(x / 10);
}
putchar(x % 10 + '0');
}
const int MAXN = 2e5 + 5, MAXM = 2e5 + 5, INF = 1e9 + 5, MOD = 1e9 + 7;
const ll LMOD = (ll) 1e18 + 9;
const ll LINF = 1e18 + 5;
const ld ep = 1e-8, Pi = acos(-1.0);
string s;
string ss = "ABXY";
// int cnt = 0;
//
// int press(string p){
// int ret = 0;
// int n = (int) s.size();
// int m = (int) p.size();
// for(int i = 0; i < m; ++i){
// for(int j = 0; j < n && i + j < m; ++j){
// if(p[i + j] == s[j]){
// ret = max(ret, j + 1);
// }
// else break;
// }
// }
// ++cnt;
// return ret;
// }
string guess_sequence(int n){
string cur = "";
{
int res = press("AB");
if(res){
if(press("A")) cur = "A";
else cur = "B";
}
else{
if(press("X")) cur = "X";
else cur = "Y";
}
}
if(n == 1) return cur;
string t = "";
for(auto i : ss) if(i != cur[0]) t += i;
for(int i = 2; i <= n - 1; ++i){
string temp = cur + t[0] + t[0] + cur + t[0] + t[1] + cur + t[0] + t[2] + cur + t[1];
int res = press(temp);
if(res == i + 1) cur += t[0];
else if(res == i) cur += t[1];
else cur += t[2];
}
if(press(cur + t[0]) == n) cur += t[0];
else if(press(cur + t[1]) == n) cur += t[1];
else cur += t[2];
return cur;
}
void clear(){
}
// int main(){
//
// cin >> s;
// cout << guess_sequence(s.size()) << " " << cnt << "\n";
// return 0;
// }
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |