제출 #1327355

#제출 시각아이디문제언어결과실행 시간메모리
1327355kitijakValley (BOI19_valley)C++20
컴파일 에러
0 ms0 KiB
#include <iostream>
#include<algorithm>
#include <vector>
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;
    ll n, s, q, e, u, v, w;
    vector<pair<pair<int, int>, int>>graph[100005];
    vector<pair<int, int>>edge;
    bool shop[100005];
ll dfs(int x, int p, int road, ll d){
    if(x==e){
        return -1;
    }
    ll dist=INT_MAX;
    if(shop[x])
        dist=d;
    for(auto y : graph[x]){
        if(y.se!=road && y.fi.fi!=p){
            dist=min(dist, dfs(y.fi.fi, x, road, d+y.fi.se));
        }

    }
    return dist;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> s >> q >> e;
    for(int i=1; i<n; i++){
        cin >> u >> v >> w;
        graph[u].pb({{v, w}, i});
        graph[v].pb({{u, w}, i});
    }
    for(int i=0; i<s; i++){
        cin >> u;
        shop[u]=1;
    }
    while(q--){
        cin >> u >> v;
        ll mn=dfs(v, v, u, 0LL);
        if(mn==-1)
            cout << "escaped\n";
        else if(mn==INT_MAX)
            cout << "oo\n";
        else
            cout << mn << '\n';
    }
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

valley.cpp: In function 'long long int dfs(int, int, int, long long int)':
valley.cpp:17:13: error: 'INT_MAX' was not declared in this scope
   17 |     ll dist=INT_MAX;
      |             ^~~~~~~
valley.cpp:4:1: note: 'INT_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?
    3 | #include <vector>
  +++ |+#include <climits>
    4 | #define ll long long
valley.cpp: In function 'int main()':
valley.cpp:47:21: error: 'INT_MAX' was not declared in this scope
   47 |         else if(mn==INT_MAX)
      |                     ^~~~~~~
valley.cpp:47:21: note: 'INT_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?