Submission #741815

# Submission time Handle Problem Language Result Execution time Memory
741815 2023-05-15T01:02:14 Z 1zaid1 Swapping Cities (APIO20_swap) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

const int M = 1e5+5;
vector<pair<int, int>> node[M];
vector<array<int, 3>> E;

int n, m;
int mx = 0, cycle = 3;
void init(int _n, int _m, vector<int> U, vector<int> V, vector<int> W) {
    n = _n, m = _m;
    for (int i = 0; i < m; i++) E.push_back({U[i], V[i], W[i]});
    for (auto [a, b, c]:E) 
        node[a].push_back({b, c}),
        node[b].push_back({a, c});
    for (int i = 0; i < n; i++) cycle = min(cycle, (int)node[i].size());
    for (auto [a, b, c]:E) mx = max(mx, c);
}


int getMinimumFuelCapacity(int X, int Y) {
    // int x = solve(X, Y);
    // if (x > 1e9) return -1;
    // return x+1;

    if (cycle) return mx;
    return -1;
}

int main() {
  int N, M;
  assert(2 == scanf("%d %d", &N, &M));
  
  std::vector<int> U(M), V(M), W(M);
  for (int i = 0; i < M; ++i) {
    assert(3 == scanf("%d %d %d", &U[i], &V[i], &W[i]));
  }

  int Q;
  assert(1 == scanf("%d", &Q));

  std::vector<int> X(Q), Y(Q);
  for (int i = 0; i < Q; ++i) {
    assert(2 == scanf("%d %d", &X[i], &Y[i]));
  }

  init(N, M, U, V, W);
  
  std::vector<int> minimum_fuel_capacities(Q);
  for (int i = 0; i < Q; ++i) {
    minimum_fuel_capacities[i] = getMinimumFuelCapacity(X[i], Y[i]);
  }

  for (int i = 0; i < Q; ++i) {
    printf("%d\n", minimum_fuel_capacities[i]);
  }
  
  return 0;
}

Compilation message

/usr/bin/ld: /tmp/ccg98zuJ.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccHwM0nI.o:swap.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status