답안 #905285

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
905285 2024-01-12T22:14:04 Z rainboy Cup of Jamshid (IOI17_cup) C++17
100 / 100
1 ms 348 KB
#include "cup.h"

using namespace std;

typedef vector<int> vi;

const int X = 1000000000, L = 30;

vi find_cup() {
	int d = ask_shahrasb(-X, -X), x = -X;
	for (int l = 0; l < L; l++)
		if ((ask_shahrasb(-X + (1 << l), -X) ^ d) == (1 << l))
			x += (1 << l);
	if (x < -X / 2)
		x += 1 << L;
	int y = (d ^ x + X) - X;
	return { x, y };
}

Compilation message

cup.cpp: In function 'vi find_cup()':
cup.cpp:16:17: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   16 |  int y = (d ^ x + X) - X;
      |               ~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct