답안 #993126

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
993126 2024-06-05T10:41:23 Z caterpillow 보물 찾기 (CEOI13_treasure2) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "sensor.h"

/*

basically already full solution

*/

using namespace std;

using ll = long long;
using pl = pair<ll, ll>;
#define vt vector
#define f first
#define s second
#define all(x) x.begin(), x.end() 
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define ROF(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define F0R(i, b) FOR (i, 0, b)
#define endl '\n'
const ll INF = 1e18;

template<template<typename> class Container, typename T>
ostream& operator<<(ostream& os, Container<T> o) {
    os << "{"; 
    int g = o.size(); 
    for (auto i : o) os << i << ((--g) == 0 ? "" : ", "); 
    os << "}";
    return os;
}

void _print() {
    cerr << "\n";
}

template<typename T, typename ...V>
void _print(T t, V... v) {
    cerr << t; if (sizeof...(v)) cerr << ", "; _print(v...);
}

#ifdef LOCAL
#define dbg(x...) cerr <<__func__ << ":" <<__LINE__ << " " << #x << " = "; _print(x);
#else
#define dbg(x...)
#endif

using t4 = tuple<int, int, int, int>;
map<t4, int> memo;

int count(int a, int b, int c, int d) {
    t4 t = {a, b, c, d};
    auto it = memo.find(t);
    if (it == memo.end()) return memo[t] = countRectangle(a, b, c, d);
    else return it->s;
}

main() {
    int n = getN();

    if (n < 6) {
        vt<vt<ll>> pfx(n + 1, vt<ll>(n + 1));
        FOR (i, 1, n + 1) {
            FOR (j, 1, n + 1) {
                pfx[i][j] = count(1, 1, i, j);
            }
        }
        FOR (i, 1, n + 1) {
            FOR (j, 1, n + 1) {
                valueAtSquare(i, j, pfx[i][j] - pfx[i - 1][j] - pfx[i][j - 1] + pfx[i - 1][j - 1]);
            }
        }
    }

    vt<vt<ll>> pfxul(n + 2, vt<ll>(n + 2)), pfxur, pfxbl, pfxbr;
    pfxur = pfxbl = pfxbr = pfxul;
    ll m = (n + 3) / 2;
    cerr << m << endl;

    cerr << "1\n";

    FOR (i, 1, m + 1) {
        FOR (j, 1, m + 1) {
            pfxul[i][j] = count(i, j, n, n);
        }
    }

    FOR (i, 1, m) {
        FOR (j, 1, m) {
            valueAtSquare(i, j, pfxul[i][j] - pfxul[i + 1][j] - pfxul[i][j + 1] + pfxul[i + 1][j + 1]);
        }
    }

    cerr << "2\n";

    FOR (i, 1, m + 1) {
        FOR (j, m - 1, n + 1) {
            pfxur[i][j] = count(i, 1, n, j);
        }
    }

    FOR (i, 1, m) {
        FOR (j, m, n + 1) {
            valueAtSquare(i, j, pfxur[i][j] - pfxur[i + 1][j] - pfxur[i][j - 1] + pfxur[i + 1][j - 1]);
        }
    }

    cerr << "3\n";

    FOR (i, m - 1, n + 1) {
        FOR (j, 1, m + 1) {
            pfxbl[i][j] = count(1, j, i, n);
        }
    }

    FOR (i, m, n + 1) {
        FOR (j, 1, m) {
            valueAtSquare(i, j, pfxbl[i][j] - pfxbl[i - 1][j] - pfxbl[i][j + 1] + pfxbl[i - 1][j + 1]);
        }
    }

    cerr << "4\n";

    FOR (i, m - 1, n + 1) {
        FOR (j, m - 1, n + 1) {
            pfxbr[i][j] = count(1, 1, i, j);
        }
    }

    FOR (i, m, n + 1) {
        FOR (j, m, n + 1) {
            valueAtSquare(i, j, pfxbr[i][j] - pfxbr[i - 1][j] - pfxbr[i][j - 1] + pfxbr[i - 1][j - 1]);
        }
    }
}

Compilation message

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