#include "cup.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> find_cup() {
vector<long long> sor(30);
sor[0] = ask_shahrasb((1LL << 29), 1e9);
for (int i = 0; i < 29; i++){
sor[i + 1] = ask_shahrasb((1LL << 29) + (1LL << i), 1e9);
}
for (int i = 1; i < 30; i++){
sor[i] ^= sor[0];
}
long long int x = 0;
for (int i = 1; i < 30; i++){
if (sor[i] > (1LL << i)){
x += (1LL << (i - 1));
}
}
x *= -1;
long long int y = 1e9 - (sor[0] ^ ((1LL << 29) - x));
if (y < -5e8 || y > 5e8 || ask_shahrasb(x - 1, y + 1) != 0 || ask_shahrasb(x + 1, y + 1) != 0){
x = (1LL << 29) + x;
y = 1e9 - (sor[0] ^ ((1LL << 29) - x));
}
vector<int> result(2);
result[0] = x;
result[1] = y;
return result;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |