Submission #977601

# Submission time Handle Problem Language Result Execution time Memory
977601 2024-05-08T07:29:31 Z Ning07 Swapping Cities (APIO20_swap) C++17
Compilation error
0 ms 0 KB
#include "swap.h"

#include <vector>
#include<bits/stdc++.h>
using namespace std;

#define L(i, j, k) for (int i = (j); i <= k; i++) 
#define R(i, j, k) for (int i = (j); i >= k; i--) 

int N, M;
int ok = true;
int mx = -1;
vector<vector<pair<int, int>>> adj;

void init(int _N, int _M, std::vector<int> _U, std::vector<int> _V, std::vector<int> _W) {
   N = _N; M = _M;
    adj.resize(N);
    for (int i = 0; i < M; i++) {
        G[_U[i]].push_back(make_pair(_V[i], _W[i]));
        G[_V[i]].push_back(make_pair(_U[i], _W[i]));
        mx = max(mx, _W[i]);
    }
    for (int i = 0; i < N; i++) 
        if (adj[i].size() <= 1) 
            ok = false;
}

int getMinimumFuelCapacity(int X, int Y) {
    if (!ok) return -1;
    return mx;
}

Compilation message

swap.cpp: In function 'void init(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
swap.cpp:19:9: error: 'G' was not declared in this scope
   19 |         G[_U[i]].push_back(make_pair(_V[i], _W[i]));
      |         ^