# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
597297 | Abdulmohsen1284 | Combo (IOI18_combo) | C++14 | 40 ms | 520 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"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class x>
using ordered_set = tree<x, null_type,less<x>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void usaco(){freopen("cruise.out","w",stdout);freopen("cruise.in","r",stdin);}
long long a[2000005],c[2000005];
#include "combo.h"
std::string guess_sequence(int N) {
int n=N;
string ans;
string fr="AB",sc="XY";
set <char> h;
h.insert('A');
h.insert('X');
h.insert('B');
h.insert('Y');
int coin = press(fr);
if(coin>0)
{
fr="A";
coin = press(fr);
if(coin>0)
{
h.erase('A');
ans+="A";
}
else
{
h.erase('B');
ans+="B";
}
}
else
{
sc="X";
coin = press(sc);
if(coin>0)
{
h.erase('X');
ans+="X";
}
else
{
h.erase('Y');
ans+="Y";
}
}
if(n==1)
return ans;
vector <char> v;
for(auto i : h)
v.push_back(i);
long long bef=1;
for(int i=1;i<N-1;i++)
{
bef=i;
string cur = ans+v[0]+ans+v[1]+v[0]+ans+v[1]+v[1]+ans+v[1]+v[2];
int bruh = press(cur);
if(bruh==bef)
{
ans+=v[2];
}
else if(bruh==bef+1)
{
ans+=v[0];
}
else
ans+=v[1];
}
fr=ans+v[0]+ans+v[1];
int bruh = press(fr);
if(bruh==n)
{
fr=ans+v[0];
bruh = press(fr);
if(bruh==n)
ans+=v[0];
else
ans+=v[1];
}
else
ans+=v[2];
return ans;
}
/*
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
}*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |