Submission #60970

# Submission time Handle Problem Language Result Execution time Memory
60970 2018-07-25T04:40:48 Z kingpig9 Cup of Jamshid (IOI17_cup) C++11
0 / 100
4 ms 376 KB
#include <bits/stdc++.h>
#include "cup.h"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define fillchar(a, s) memset((a), (s), sizeof(a))

bool isdesert (int x) {
	return abs(x) <= 5e8;
}

bool isdesert (int x, int y) {
	return isdesert(x) && isdesert(y);
}

vector<int> find_cup() {
	//find the x value first
	int dbase = ask_shahrasb(5e8, 5e8);
	int dx = 0;
	for (int i = 0; i <= 28; i++) {
		int di = ask_shahrasb(5e8 + (1 << i), 5e8) ^ dbase;
		di = ((di >> i) + 1) / 2;
		assert((di & (di - 1)) == 0);

		if (di != 1) {
			dx ^= (1 << i);
		}
	}
	//hmm we need to find the 2^29 digit in a special way.
	//could be (1 << 29)
	bool isse = false;

	for (int b29 : {0, 1 << 29}) {
		dx ^= b29;
		int x = 5e8 - dx;
		int dy = ask_shahrasb(x, 5e8);
		int y = 5e8 - dy;

		if (isse || ask_shahrasb(x, y) == 0) {
			return vector<int> {x, y};
		}

		dx ^= b29;
		isse = true;
	}
}

Compilation message

cup.cpp: In function 'std::vector<int> find_cup()':
cup.cpp:53:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 376 KB wrong cup location