Submission #935672

# Submission time Handle Problem Language Result Execution time Memory
935672 2024-02-29T11:08:48 Z Matthewwww Aliens (IOI07_aliens) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define f first
#define s second
#include "aliens.h"
using namespace std;
#define int long long
int clz(int a){
  return a ? __builtin_clzll(a) : 63;
}
int n;
bool query (int a, int b){
  return a > 0 && b > 0 && a <= n && b <= n && use_device(a, b);
}

pair<signed, signed> help_aliens(signed aoehtn, signed a, signed b){
  n = aoehtn;
  int lax = a, rax = a, lby = b, rby = b;
  for (int i = 1;1; i *= 2){
    if (query(a-i, b))
      lax = a-i;
    else break;
  }
  int val = a-lax;
  for (int i = 1ll<<63-clz(val); i; i >>= 1)
    if (query(lax-i, b))
      lax -= i;
  for (int i = 1;1; i *= 2){
    if (query(a+i, b))
      rax = a+i;
    else break;
  }
  val = rax-a;
  for (int i = 1ll<<63-clz(val); i; i >>= 1)
    if (query(rax+i, b))
      rax += i;
  for (int i = 1;1; i *= 2){
    if (query(a, b-i))
      lby = b-i;
    else break;
  }
  val = b-lby;
  for (int i = 1ll<<63-clz(val); i; i >>= 1)
    if (query(a, lby-i))
      lby -= i;
  for (int i = 1;1; i *= 2){
    if (query(a, b+i))
      rby = b+i;
    else break;
  }
  val = rby-b;
  for (int i = 1ll<<63-clz(val); i; i >>= 1)
    if (query(a, rby+i))
      rby += i;
  assert(rax-lax == rby-lby);
  int len = rax-lax+1;
  pair<int, int> cenc = {lax+len/2, lby+len/2};
  pair<int, int> ans = cenc;
  for (int i = 1; i < 391; i++){
    if (query(cenc.f+i*len, cenc.s+i%2*len) || query(cenc.f+i*len, cenc.s-i%2*len))
      ans.f = cenc.f+i*len;
    else
      break;
  }
  for (int i = 1; i < 391; i++){
    if (query(cenc.f+i%2*len, cenc.s+i*len) || query(cenc.f-i%2*len, cenc.s+i*len))
      ans.s = cenc.s+i*len;
    else
      break;
  }
  return {ans.f-2*len, ans.s-2*len};
}
#undef int


Compilation message

aliens.cpp:4:10: fatal error: aliens.h: No such file or directory
    4 | #include "aliens.h"
      |          ^~~~~~~~~~
compilation terminated.