답안 #955266

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
955266 2024-03-30T02:38:08 Z Lithanium Aliens (IOI07_aliens) C++17
컴파일 오류
0 ms 0 KB
#include "aliens.h"
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
 
pair<signed, signed> help_aliens(signed n, signed sx, signed sy) {
    int l, r, b;
    int low = sx, high = n;
    for (int i = 0; sx + (1 << i) <= n; i ++) {
        signed nx = sx + (1 << i);
        if (!use_device(nx, sy)) {
            high = nx;
            if (i != 0) {
                low = sx + (1 << (i-1));
            }
            break;
        }
    }
    while (high > low) {
        signed mid = (high + low + 1)/2;
        if (use_device(mid, sy)) low = mid;
        else high = mid - 1;
    }
    r = low;
    low = 1, high = sx;
    for (int i = 0; sx - (1 << i) > 0; i ++) {
        signed nx = sx - (1 << i);
        if (!use_device(nx, sy)) {
            low = nx;
            if (i != 0) {
                high = sx - (1 << (i-1));
            }
            break;
        }
    }
    while (high > low) {
        signed mid = (high + low)/2;
        if (use_device(mid, sy)) high = mid;
        else low = mid + 1;
    }
    l = low;
    low = 1, high = sy;
    for (int i = 0; sy - (1 << i) > 0; i ++) {
        signed ny = sy - (i << i);
        if (!use_device(sx, ny)) {
            low = ny;
            if (i != 0) {
                high = sy - (1 << (i-1));
            }
            break;
        }
    }
    while (high > low) {
        signed mid = (high + low)/2;
        if (use_device(sx, mid)) high = mid;
        else low = mid + 1;
    }
    b = low;
    signed cx = (l + r)/2, cy = b + (r - l)/2;
    int m = r - l + 1;
    int x1 = 0, x2 = 0;
    for (int i = 1; i <= 4; i ++) {
        signed qx = cx - 2*m*i;
        if (qx < 1) break;
        if (use_device(qx, cy)) x1 ++;
        else break;
    }
    for (int i = 1; i <= 4; i ++) {
        signed qx = cx + 2*m*i;
        if (qx > n) break;
        if (use_device(qx, cy)) x2 ++;
        else break;
    }
    int y1 = 0, y2 = 0;
    for (int i = 1; i <= 4; i ++) {
        int qy = cy - 2*m*i;
        if (qy < 1) break;
        if (use_device(cx, qy)) y1 ++;
        else break;
    }
    for (int i = 1; i <= 4; i ++) {
        int qy = cy + 2*m*i;
        if (qy > n) break;
        if (use_device(cx, qy)) y2 ++;
        else break;
    }
    cx += m*(x2 - x1);
    cy += m*(y2 - y1);
    return {cx, cy};
}

Compilation message

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