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;
#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 |
---|
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... |