답안 #733474

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
733474 2023-04-30T21:55:32 Z vjudge1 Birmingham (COCI20_birmingham) C++17
컴파일 오류
0 ms 0 KB
// author: MisterReaper (Ahmet Alp Orakci)
#include <bits/stdc++.h>
using namespace std;
#define int long long

const int MAXN = 1e5 + 5;

#ifndef ONLINE_JUDGE
    #include "debug.h"
    #define OPEN freopen(".in", "r", stdin); freopen(".out", "w", stdout);
    #define TIME cerr << "\n" << fixed << setprecision(2) << 1000.0 * clock() / CLOCKS_PER_SEC << " milliseconds ";
#else
    #define debug(...) void(23)
    #define OPEN void(0000)
    #define TIME void(232323233)
#endif

vector <int> graph[MAXN];
int ans[MAXN];

void solve()
{
    memset(ans, -1, sizeof(ans));

    int n, m, q, k; cin >> n >> m >> q >> k;
    int arr[q];
    for(int &i : arr) cin >> i;

    vector <int> vec;
    vec.emplace_back(0);
    for(int i = 1; vec.back() <= n; i++) vec.emplace_back(vec.back() + k * i);

    for(int i = 1; i <= m; i++)
    {
        int u, v; cin >> u >> v;

        graph[u].emplace_back(v);
        graph[v].emplace_back(u);
    }

    queue <pair <int, int>> que;
    for(int i : arr) que.emplace(i, 0);

    while(!que.empty())
    {
        auto [node, cost] = que.front();
        que.pop();
        if(ans[node] != -1) continue;
        ans[node] = cost;

        for(int child : graph[node])
        {
            que.emplace(child, cost +1);
        }
    }

    for(int i = 1; i <= n; i++)
    {
        debug(ans[i]);
        int ret = upper_bound(vec.begin(), vec.end(), ans[i] -1) - vec.begin();
        cout << ret << " ";
    }
    
    return;
}

int32_t main()
{
    OPEN;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t = 1; //cin >> t;
    while(t--)
    {
        solve();
    }

    TIME;

    return 0;
}

Compilation message

birmingham.cpp:9:14: fatal error: debug.h: No such file or directory
    9 |     #include "debug.h"
      |              ^~~~~~~~~
compilation terminated.