Submission #980670

# Submission time Handle Problem Language Result Execution time Memory
980670 2024-05-12T09:59:53 Z vjudge1 Hexagonal Territory (APIO21_hexagon) C++17
Compilation error
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.