#include "swap.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define fs first
#define sc second
const int mxn = 1e5+10;
vector<int> v;
int arr[mxn];
int N,M;
void init(int NN, int MM,
std::vector<int> U, std::vector<int> V, std::vector<int> W) {
v.clear();
N = NN,M = MM;
for(int i = 0;i<M;i++){
arr[V[i]] = W[i];
v.push_back(W[i]);
}
sort(v.begin(),v.end());
return;
}
int getMinimumFuelCapacity(int X, int Y) {
if(!X){
if(N<4)return -1;
if(arr[Y]<v[2])return v[2];
else return arr[Y];
}
if(N<=3)return -1;
vector<int> tmp = {arr[X],arr[Y]};
sort(tmp.begin(),tmp.end());
if(tmp[0] == v[0]&&tmp[1] == v[1])return v[2];
else return tmp[1];
}
# |
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 |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
5 |
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 |
78 ms |
6512 KB |
Output is correct |
4 |
Correct |
73 ms |
6452 KB |
Output is correct |
5 |
Correct |
76 ms |
6584 KB |
Output is correct |
6 |
Correct |
78 ms |
6444 KB |
Output is correct |
7 |
Correct |
82 ms |
6568 KB |
Output is correct |
8 |
Correct |
74 ms |
6452 KB |
Output is correct |
9 |
Correct |
79 ms |
6404 KB |
Output is correct |
10 |
Correct |
74 ms |
6436 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 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
5 |
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 |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
5 |
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 |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
5 |
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 |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |