Submission #72581

# Submission time Handle Problem Language Result Execution time Memory
72581 2018-08-26T10:07:12 Z funcsr Cup of Jamshid (IOI17_cup) C++17
100 / 100
3 ms 248 KB
#include "cup.h"
#include <iostream>
using namespace std;
#define rep(i, n) for (int i=0; i<(n); i++)

long long query(int x, int y) {
  return ask_shahrasb(x-5e8, y-1e9);
}
std::vector<int> find_cup() {
  long long g = query(0, 0);
  long long X = 0;
  rep(k, 29) if (((query(-(1LL<<k), 0)>>(k+1))&1) != ((g>>(k+1))&1)) X |= 1<<k;

  long long x = X;
  long long y = x^g;
  x-=5e8;
  y -= 1e9;
  if (x<-5e8||x>5e8||y<-5e8||y>5e8){}
  else{
    if(ask_shahrasb(x-1,y)==1 && ask_shahrasb(x+1,y)==1) return {(int)x,(int)y};
  }

  x = X;
  x ^= 1LL<<29;
  y = x^g;
  x-=5e8;
  y -= 1e9;
  return {(int)x,(int)y};
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct