#include <bits/stdc++.h>
#include "cup.h"
using namespace std;
long long ma=1e9;
vector<int> find_cup()
{
long long i,ii,mk=ask_shahrasb(-ma/2,-ma/2),mk2,mk3,e;
vector<int> v={0,0};
for(i=0;1ll<<i<=ma/2;i++)
{
mk2=ask_shahrasb(-ma/2-(1ll<<i),-ma/2);
mk3=mk^mk2;
e=mk3>>i+1&1;
v[0]|=e<<i;
v[1]|=((mk>>i&1)^e)<<i;
}
mk2=ask_shahrasb(-ma/2+1,-ma/2);
mk3=ask_shahrasb(-ma/2+1+(1ll<<29),-ma/2);
e=!((mk2^mk3)&(1ll<<29)-1);
v[0]|=e<<29;
v[1]|=((mk>>i&1)^e)<<29;
for(ii=0;ii<2;ii++)
{
v[ii]-=ma/2;
}
return v;
}
Compilation message
cup.cpp: In function 'std::vector<int> find_cup()':
cup.cpp:17:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
17 | e=mk3>>i+1&1;
| ~^~
cup.cpp:23:25: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
23 | e=!((mk2^mk3)&(1ll<<29)-1);
| ~~~~~~~~~^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
wrong cup location |