This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
ID: Yassine BenYounes
TASK: time
LANG: C++
*/
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pbds tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update>
using namespace __gnu_pbds;*/
ll gcd(ll a , ll b) {return b ? gcd(b , a % b) : a ;} // greatest common divisor (PGCD)
ll lcm(ll a , ll b) {return (a * b) / gcd(a , b);} // least common multiple (PPCM)
ll modd(ll x, ll n){while(x < 0){x += n;}return (x % n);} // modulo for negative numbers
int dx[8] = {0, -1, 0, 1, 1, 1, -1, -1};
int dy[8] = {-1, 0, 1, 0, -1, 1, -1, 1};
#define endl "\n"
#define ss second
#define ff first
#define all(x) (x).begin() , (x).end()
#define pb push_back
#define vi vector<int>
#define vii vector<pair<int,int>>
#define vl vector<ll>
#define vll vector<pair<ll,ll>>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vdd vector<pdd>
#define speed ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
void init(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
const int mx = 1e6+9;
const ll mod = 1e9+7;
const int inf = 1e9;
int press(string p);
string guess_sequence(int N){
string s;
if(press("AB")!=0){
if(press("A") != 0)s = "A";
else s = "B";
}
else{
if(press("X") != 0)s = "X";
else s = "Y";
}
vector<string> v;
if(s != "A")v.pb("A");
if(s != "B")v.pb("B");
if(s != "X")v.pb("X");
if(s != "Y")v.pb("Y");
for(int i = 2; i <= N;i++){
if(i == N){
int a = press(s + v[0]);
int b = press(s + v[1]);
if(a == b){
s += v[2];
}
else{
if(a > b){
s += v[0];
}
else s += v[1];
}
continue;
}
string res = s+v[0]+s+v[1]+v[0]+s+v[1]+v[1]+s+v[1]+v[2];
int c = press(res);
if(c == i+1){
s += v[1];
}
else if(c == i){
s += v[0];
}
else{
s += v[2];
}
}
return s;
}
/*
int main(){
//ofstream fout ("teamwork.out");
//ifstream fin ("teamwork.in");
init();
speed;
cout << guess_sequence(10) << endl;
}*/
/*
NEVER GIVE UP!
DOING SMTHNG IS BETTER THAN DOING NTHNG!!!
*/
Compilation message (stderr)
combo.cpp: In function 'void init()':
combo.cpp:40:8: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
40 | freopen("input.txt", "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
combo.cpp:42:8: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
42 | freopen("output.txt", "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |