제출 #569751

#제출 시각아이디문제언어결과실행 시간메모리
569751sumit_kk10자매 도시 (APIO20_swap)C++17
컴파일 에러
0 ms0 KiB
#include "swap.h" #define pb push_back #include <vector> #include<bits/stdc++.h> const int N = 1e6 + 5; vector<pair<int, int> > g[N]; int mx, n, m; void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) { n = N; m = M; for(int i = 0; i < M; ++i){ int u = U[i], v = V[i], w = W[i]; g[u].pb({v, w}); g[v].pb({u, w}); mx = max(mx, w); } } int getMinimumFuelCapacity(int X, int Y) { if(m == n - 1) return -1; else return mx; }

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

swap.cpp:6:1: error: 'vector' does not name a type
    6 | vector<pair<int, int> > g[N];
      | ^~~~~~
swap.cpp: In function 'void init(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
swap.cpp:16:3: error: 'g' was not declared in this scope
   16 |   g[u].pb({v, w});
      |   ^
swap.cpp:18:8: error: 'max' was not declared in this scope; did you mean 'std::max'?
   18 |   mx = max(mx, w);
      |        ^~~
      |        std::max
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from swap.cpp:4:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~