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;
#define ll long long
const int N = 100005;
ll n, m, v[N];
multiset <ll> s;
void init(int n1, int m1, vector<int> u1, vector<int> v1, vector<int> w1) {
m = m1;
for(int i = 0; i < m1; i++){
v[v1[i]] = (w1[i]);
s.insert(w1[i]);
}
}
int getMinimumFuelCapacity(int x, int y) {
if(m <= 2 or min(x,y) == 0) return -1;
ll ans = (v[x]+v[y]);
s.erase(s.find(v[x]));
s.erase(s.find(v[y]));
ans += 2*(*s.begin());
s.insert(v[x]);
s.insert(v[y]);
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... |