답안 #980670

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
980670 2024-05-12T09:59:53 Z vjudge1 육각형 영역 (APIO21_hexagon) C++17
컴파일 오류
0 ms 0 KB
#include "jumps.h"
#include<bits/stdc++.h>
#define sz size()
#define ll int
using namespace std;
const ll INF = 1e9;
int n, ok = 1;
vector<vector<ll>> v;

void init(int N, vector<int> h)
{
    n = N;
    v.resize(n);
    vector<ll> q;
    for(ll i = 0; i < n; ++i)
    {
        ok &= h[i] == i + 1;
        while(q.sz && h[q.back()] < h[i])
            v[q.back()].push_back(i),
            q.pop_back();
        q.push_back(i);
    }
    q.clear();
    for(ll i = n - 1; i >= 0; --i)
    {
        while(q.sz && h[q.back()] < h[i])
            v[q.back()].push_back(i),
            q.pop_back();
        q.push_back(i);
    }
}

int minimum_jumps(int a, int b, int c, int d)
{
        if(ok) return c - b;
        vector<ll> dist(n, INF);
        queue<ll> q;
        for(ll i = a; i <= b; ++i)
        {
            dist[i] = 0;
            q.push(i);
        }
        while(q.sz)
        {
            ll s = q.front();
            q.pop();
            for(ll t : v[s])
            {
                if(dist[t] < INF) continue;
                dist[t] = dist[s] + 1;
                q.push(t);
            }
        }
        ll ans = INF;
        for(ll i = c; i <= d; ++i)
            ans = min(ans, dist[i]);
        return ans < INF ? ans : -1;
}

//signed main()
//{
//    ios_base::sync_with_stdio(0);
//    cin.tie(0), cout.tie(0);
//}

Compilation message

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