This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "swap.h"
using namespace std;
int n, m;
vector <int> u, v, w;
void init(int n1, int m1, vector<int> u1, vector<int> v1, vector<int> w1) {
n = n1, m = m1, u = u1, v = v1, w = w1;
}
int getMinimumFuelCapacity(int x, int y) {
if(m <= 2){
return -1;
}
if(x > y) swap(x,y);
int ans = 0, mn = 1e9;
for(int i = 0; i < m; i++){
if(max(u[i],v[i]) == x or max(u[i],v[i]) == y) ans += w[i];
else mn = min(mn,w[i]);
}
ans += 2*(mn);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |