# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
40381 | model_code | Cup of Jamshid (IOI17_cup) | C++11 | 3 ms | 248 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 = 71;
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... |