# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
518942 | omohamadooo | Combo (IOI18_combo) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define pb push_back
#define endl '\n'
#define pii pair<ll,ll >
#define F first
#define S second
#define double long double
#define all(x) (x).begin(),(x).end()
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll , null_type , less<ll> ,rb_tree_tag ,tree_order_statistics_node_update >ordered_set;
const int MOD=1e9+7 ;
const int N=4e6+7;
const ll INF= 1e18+10;
ll po(ll x,ll y)
{
ll ans = 1;
while(y){
if( y & 1 ) ans *=x;
y /= 2;
x *=x;
//x %= MOD;
//ans %= MOD;
}
return ans;
}
string guess_sequence(int n)
{
string s;
char c;
if(press("AB")){
if(press("A")) c ='A';
else c = 'B';
}
else{
if(press("X")) c= 'X';
else c = 'Y';
}
s += c;
string t;
if(c != 'A') t += 'A';
if(c != 'B' ) t += 'B';
if(c != 'X') t += 'X';
if(c != 'Y') t += 'Y';
for(ll i= 2;i<n;i++){
string que = s;
for(ll j= 0;j<3;j++){
que += t[0];
que += t[j];
que += s;
}
que += t[1];
ll ans = press(que);
if(ans == i+1) s += t[0];
else if(ans == i) s += t[1];
else s += t[2];
}
if(press(s + t[0] + s + t[1]) == n ){
if(press(s + t[0])) s += t[0];
else s += t[1];
}
else s += t[2];
return s;
}
/*
int main(){
//ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//freopen("dishes.in" , "r" , stdin);freopen("dishes.out" , "w" , stdout);
int t = 1;
//cin >> t;
//while(t--) {solve() ; }
}
*/