Submission #707491

# Submission time Handle Problem Language Result Execution time Memory
707491 2023-03-09T05:39:27 Z josanneo22 Swapping Cities (APIO20_swap) C++17
0 / 100
1 ms 296 KB
//#include "swap.h"
#include<bits/stdc++.h>
#include <vector>
using namespace std;
vector<vector<pair<int,int>>> adj;
long long sm = 0;
int cycle = 1;
void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) {
    int n, m; n = N; m = M;
    for (int i = 0; i < n; i++) {
        adj[U[i]].push_back(make_pair(V[i], W[i]));
        sm += (long long)W[i];
    }
    for (int i = 0; i < n; i++) {
        if (adj[i].size() == 1) cycle = 0;
    }
}

int getMinimumFuelCapacity(int X, int Y) {
    if (cycle == 1) cout << sm << '\n';
    else cout << "-1\n";
}

Compilation message

swap.cpp: In function 'void init(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
swap.cpp:9:12: warning: variable 'm' set but not used [-Wunused-but-set-variable]
    9 |     int n, m; n = N; m = M;
      |            ^
swap.cpp: In function 'int getMinimumFuelCapacity(int, int)':
swap.cpp:22:1: warning: no return statement in function returning non-void [-Wreturn-type]
   22 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 296 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 296 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 296 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 296 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 296 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 296 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -