#include "swap.h"
#include <bits/stdc++.h>
using namespace std;
#define all(a) begin(a),end(a)
#define sz(a) (int)a.size()
const int mxN = (int)3e5+10;
multiset<int> S;
int edge[mxN];
void init(int N, int M, vector<int> U, vector<int> V, vector<int> W) {
for(auto u : W) S.insert(u);
for(int i = 0; i < M; i++)
edge[V[i]] = W[i];
}
int getMinimumFuelCapacity(int X, int Y) {
int ans = 0;
if(X==0){
ans = max(ans, edge[Y]);
S.erase(S.find(edge[Y]));
if(sz(S)<2) return -1;
ans = max(ans, *next(begin(S)));
S.insert(edge[Y]);
}
else{
ans = max(ans, edge[X]);
ans = max(ans, edge[Y]);
S.erase(S.find(edge[X]));
S.erase(S.find(edge[Y]));
if(S.empty()) return -1;
ans = max(ans, *begin(S));
S.insert(edge[X]);
S.insert(edge[Y]);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Runtime error |
0 ms |
348 KB |
Execution killed with signal 6 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
192 ms |
10388 KB |
Output is correct |
4 |
Correct |
184 ms |
14520 KB |
Output is correct |
5 |
Correct |
201 ms |
14676 KB |
Output is correct |
6 |
Correct |
208 ms |
14396 KB |
Output is correct |
7 |
Correct |
199 ms |
14552 KB |
Output is correct |
8 |
Correct |
202 ms |
14340 KB |
Output is correct |
9 |
Correct |
195 ms |
14288 KB |
Output is correct |
10 |
Correct |
190 ms |
14092 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Runtime error |
0 ms |
348 KB |
Execution killed with signal 6 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Runtime error |
0 ms |
348 KB |
Execution killed with signal 6 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Runtime error |
0 ms |
348 KB |
Execution killed with signal 6 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Runtime error |
0 ms |
348 KB |
Execution killed with signal 6 |
4 |
Halted |
0 ms |
0 KB |
- |