# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
40377 | model_code | Cup of Jamshid (IOI17_cup) | C++11 | 3 ms | 248 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 "cup.h"
#include <iostream>
using namespace std;
typedef long long ll;
const ll maxn=5e8;
ll x,tmp,tmp1,y;
bool same(int k)
{
ll help=(((ll)1)<<33)-1-(((ll)1)<<k);
return ((tmp&help)==(tmp1&help));
}
ll f(ll k)
{
for(int i=33;i>-1;i--)
if((k>>i)&1)
return (((ll)1)<<i);
return 0;
}
vector<int> find_cup()
{
int Q = 32;
for (int i=32; i<Q; i++)
tmp=tmp^ask_shahrasb(0,0);
x=y=tmp1=tmp^tmp;
tmp=ask_shahrasb(-2*maxn,-maxn);
for(int i=0;i<31;i++)
{
ll k=(((ll)1)<<i);
tmp1=ask_shahrasb(-2*maxn+k,-maxn);
if(same(i))
y+=k^(tmp&k);
else
y+=(tmp&k);
}
x=y^tmp;
if(-2*maxn+x>maxn)
x-=f(x);
vector<int> res(1, (int)(-2*maxn+x));
res.push_back((int)(-maxn+(tmp^x)));
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |