제출 #62003

#제출 시각아이디문제언어결과실행 시간메모리
62003Osama_Alkhodairy공장들 (JOI14_factories)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "factories.h" using namespace std; #define ll long long int n; ll dist[5001]; vector <pair <int, ll> > v[5001]; void Init(int N, int A[], int B[], int D[]) { n = N; for(int i = 0 ; i < N ; i++){ v[A[i]].push_back(make_pair(B[i], D[i])); v[B[i]].push_back(make_pair(A[i], D[i])); } } long long Query(int S, int X[], int T, int Y[]) { set <pair <ll, int> > ready; for(int i = 0 ; i < N ; i++) dist[i] = 1e18; for(int i = 0 ; i < S ; i++){ dist[X[i]] = 0; ready.insert(make_pair(0, X[i])); } while(ready.size()){ auto cur = *ready.begin(); ready.erase(ready.begin()); for(auto &i : v[cur.second]){ if(i.second + cur.first < dist[i.first]){ dist[i.first] = i.second + cur.first; ready.insert(make_pair(dist[i.first], i.first)); } } } ll ret = 1e18; for(int i = 0 ; i < T ; i++) ret = min(ret, dist[Y[i]]); return ret; }

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

factories.cpp: In function 'long long int Query(int, int*, int, int*)':
factories.cpp:19:25: error: 'N' was not declared in this scope
     for(int i = 0 ; i < N ; i++)
                         ^