제출 #1225890

#제출 시각아이디문제언어결과실행 시간메모리
1225890paskalisapo자매 도시 (APIO20_swap)C++20
컴파일 에러
0 ms0 KiB
int citiesnum , roadnum;
vector<vector<pair<int,int>>> adj;
vector<bool> visited;
bool circle = false;
int maxweight = 0;
void dfs(int cur, int par) {
    for(auto &x : adj[cur]) {
        if(x.first == par) {
            continue;
        }
        if(visited[x.first]) {
            circle = true;
            continue;
        }
        visited[x.first] = true;
        dfs(x.first, cur); 
    }
}
void init(int N, int M,
    std::vector<int> U, std::vector<int> V, std::vector<int> W) {
    citiesnum = N;
    roadnum = M;
    adj.resize(N);
    visited.resize(N);
    for(int i = 0 ;i < M; i++) {
        adj[U[i]].push_back({V[i], W[i]});
        adj[V[i]].push_back({U[i], W[i]});
        maxweight = max(maxweight, W[i]);
    }
    dfs(0 , -1);
}

int getMinimumFuelCapacity(int X, int Y) {
    if(circle) {
        return maxweight;
    }
    return -1;
}

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

swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:1: error: 'vector' does not name a type
    2 | vector<vector<pair<int,int>>> adj;
      | ^~~~~~
swap.cpp:3:1: error: 'vector' does not name a type
    3 | vector<bool> visited;
      | ^~~~~~
swap.cpp: In function 'void dfs(int, int)':
swap.cpp:7:19: error: 'adj' was not declared in this scope
    7 |     for(auto &x : adj[cur]) {
      |                   ^~~
swap.cpp:11:12: error: 'visited' was not declared in this scope
   11 |         if(visited[x.first]) {
      |            ^~~~~~~
swap.cpp:15:9: error: 'visited' was not declared in this scope
   15 |         visited[x.first] = true;
      |         ^~~~~~~
swap.cpp: At global scope:
swap.cpp:20:5: error: 'std::vector' has not been declared
   20 |     std::vector<int> U, std::vector<int> V, std::vector<int> W) {
      |     ^~~
swap.cpp:20:16: error: expected ',' or '...' before '<' token
   20 |     std::vector<int> U, std::vector<int> V, std::vector<int> W) {
      |                ^
swap.cpp: In function 'void init(int, int, int)':
swap.cpp:23:5: error: 'adj' was not declared in this scope
   23 |     adj.resize(N);
      |     ^~~
swap.cpp:24:5: error: 'visited' was not declared in this scope
   24 |     visited.resize(N);
      |     ^~~~~~~
swap.cpp:26:13: error: 'U' was not declared in this scope
   26 |         adj[U[i]].push_back({V[i], W[i]});
      |             ^
swap.cpp:26:30: error: 'V' was not declared in this scope
   26 |         adj[U[i]].push_back({V[i], W[i]});
      |                              ^
swap.cpp:26:36: error: 'W' was not declared in this scope
   26 |         adj[U[i]].push_back({V[i], W[i]});
      |                                    ^
swap.cpp:28:21: error: 'max' was not declared in this scope
   28 |         maxweight = max(maxweight, W[i]);
      |                     ^~~