#include <bits/stdc++.h>
#include "swap.h"
using namespace std;
const int N = 100005;
int n, m, v[N];
multiset <int> s;
void init(int n1, int m1, vector<int> u1, vector<int> v1, vector<int> w1) {
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){
return -1;
}
int 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 |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
26 ms |
6244 KB |
Output is correct |
10 |
Correct |
33 ms |
7492 KB |
Output is correct |
11 |
Correct |
32 ms |
7244 KB |
Output is correct |
12 |
Correct |
34 ms |
7760 KB |
Output is correct |
13 |
Correct |
34 ms |
7772 KB |
Output is correct |
14 |
Correct |
29 ms |
6292 KB |
Output is correct |
15 |
Correct |
62 ms |
9440 KB |
Output is correct |
16 |
Correct |
58 ms |
9216 KB |
Output is correct |
17 |
Correct |
59 ms |
9400 KB |
Output is correct |
18 |
Correct |
59 ms |
9404 KB |
Output is correct |
19 |
Incorrect |
27 ms |
3920 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
56 ms |
8948 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
26 ms |
6244 KB |
Output is correct |
10 |
Correct |
33 ms |
7492 KB |
Output is correct |
11 |
Correct |
32 ms |
7244 KB |
Output is correct |
12 |
Correct |
34 ms |
7760 KB |
Output is correct |
13 |
Correct |
34 ms |
7772 KB |
Output is correct |
14 |
Correct |
29 ms |
6292 KB |
Output is correct |
15 |
Correct |
62 ms |
9440 KB |
Output is correct |
16 |
Correct |
58 ms |
9216 KB |
Output is correct |
17 |
Correct |
59 ms |
9400 KB |
Output is correct |
18 |
Correct |
59 ms |
9404 KB |
Output is correct |
19 |
Incorrect |
56 ms |
8948 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |