Submission #362259

# Submission time Handle Problem Language Result Execution time Memory
362259 2021-02-02T12:08:05 Z alextodoran Cup of Jamshid (IOI17_cup) C++17
100 / 100
2 ms 364 KB
/**
 ____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|

**/

#include <bits/stdc++.h>
#include "cup.h"

using namespace std;

typedef long long ll;

const int BITS = 30;

int ask_shahrasb(int x, int y);

vector <int> find_cup ()
{
    int d = 500000002;
    int xXORy = ask_shahrasb(0 - d, 0 - d);
    int x = 0, y = 0;
    for(int bit = 0; bit < BITS; bit++)
    {
        if(ask_shahrasb((1 << bit) - d, 0 - d) == (xXORy ^ (1 << bit)))
            x ^= (1 << bit);
    }
    y = x ^ xXORy;
    x -= d;
    y -= d;
    vector <int> answer;
    answer.push_back(x);
    answer.push_back(y);
    return answer;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 364 KB Output is correct