# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
60970 | kingpig9 | Cup of Jamshid (IOI17_cup) | C++11 | 4 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |