이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "swap.h"
#include <vector>
#define SIZE 100010
using namespace std;
struct A{
int u,w;
};
int sub2=1,m1=2e9,m2=2e9,m3=2e9;
vector<A> g[SIZE];
void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) {
for(int i=0;i<M;i++){
g[U[i]].push_back({V[i],W[i]});
g[V[i]].push_back({U[i],W[i]});
if(U[i]!=0) sub2=0;
if(W[i]<m1){
m3=m2,m2=m1,m1=V[i];
}else if(W[i]<m2){
m3=m2,m2=V[i];
}else if(W[i]<m3){
m3=V[i];
}
}
}
int getMinimumFuelCapacity(int X, int Y) {
//min path ที่มี node อยู่ระหว่าง path
//หา min ถนนที่เชื่อมกับโหนดตรงกลาง
//เทียบ min กับ path อื่นๆ ไปได้ (เชื่อมตรงเลยก็ได้)
if(sub2){
if(X==0 || Y==0) return -1;
if(X!=m1 && Y!=m1){
return max(g[X][0].w,max(g[Y][0].w,g[m1][0].w));
}else if(X!=m2 && Y!=m2){
return max(g[X][0].w,max(g[Y][0].w,g[m2][0].w));
}else if(X!=m3 && Y!=m3){
return max(g[X][0].w,max(g[Y][0].w,g[m3][0].w));
}
}
return 0;
}
| # | 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... |