#include <bits/stdc++.h>
#include "swap.h"
using namespace std;
#ifdef DEBUG
#include "debug.cpp"
#else
#define dbg(...)
#define dbgarr(...)
#endif
const int mxN = 1e5+1;
vector<pair<int,int>> edge;
int to[mxN],N,M;
void init(int _N, int _M,
std::vector<int> U, std::vector<int> V, std::vector<int> W) {
N = _N, M = _M;
for(int i=0; i<M; i++){
edge.push_back({W[i], V[i]});
to[V[i]] = W[i];
}
sort(edge.begin(), edge.end());
}
int getMinimumFuelCapacity(int X, int Y) {
if(N < 4)return -1;
if(X > Y)swap(X,Y);
if(X == 0){
int cnt = 0;
for(int i=0; i<M; i++){
if(edge[i].second != Y){
cnt++;
if(cnt >= 2){
return max(edge[i].first, to[Y]);
}
}
}
}
for(int i=0; i<M; i++){
if(edge[i].second != X && edge[i].second != Y){
return max({to[X], to[Y], edge[i].first});
}
}
return -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
76 ms |
6760 KB |
Output is correct |
4 |
Correct |
72 ms |
6688 KB |
Output is correct |
5 |
Correct |
73 ms |
7004 KB |
Output is correct |
6 |
Correct |
73 ms |
6700 KB |
Output is correct |
7 |
Correct |
72 ms |
6952 KB |
Output is correct |
8 |
Correct |
69 ms |
6924 KB |
Output is correct |
9 |
Correct |
71 ms |
6888 KB |
Output is correct |
10 |
Correct |
71 ms |
6928 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |