이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cyberland.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> arr) {
int n=N, m=M, k=K, h=H;
if(n>3){
return -1;
}
if(h==0) return 0;
vector<vector<double>> ct(n, vector<double> (n, -1));
for(int i=0; i<m; i++){
ct[x[i]][y[i]]=c[i];
ct[y[i]][x[i]]=c[i];
}
double res=-1;
if(ct[0][h]>=0){
res=ct[0][h];
}
if(n<3) return res;
if(ct[0][3-h]>=0 && ct[3-h][h]>=0){
if(arr[3-h]==1){
if(res<-0.5){
res=ct[0][3-h]+ct[3-h][h];
}
else{
res=min(res, ct[0][3-h]+ct[3-h][h]);
}
}
else if(arr[3-h]==0){
if(res<-0.5){
res=ct[3-h][h];
}
else{
res=min(res, ct[3-h][h]);
}
}
else{
if(k>0){
if(res<-0.5){
res=(double)ct[0][3-h]/2+ct[3-h][h];
}
else{
res=min(res, (double)ct[0][3-h]/2+ct[3-h][h]);
}
}
else{
if(res<-0.5){
res=ct[0][3-h]+ct[3-h][h];
}
else{
res=min(res, ct[0][3-h]+ct[3-h][h]);
}
}
}
}
return res;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |