Submission #421236

# Submission time Handle Problem Language Result Execution time Memory
421236 2021-06-08T22:32:43 Z Pyqe Cup of Jamshid (IOI17_cup) C++14
100 / 100
1 ms 204 KB
#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+(1ll<<29),-ma/2);
	mk3=ask_shahrasb(-ma/2+(1ll<<30),-ma/2);
	e=!((mk^mk2)&(1ll<<29)-1)&&((mk^mk3)&(1ll<<30)-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:24: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
   23 |  e=!((mk^mk2)&(1ll<<29)-1)&&((mk^mk3)&(1ll<<30)-1);
      |               ~~~~~~~~~^~
cup.cpp:23:48: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
   23 |  e=!((mk^mk2)&(1ll<<29)-1)&&((mk^mk3)&(1ll<<30)-1);
      |                                       ~~~~~~~~~^~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct