제출 #976615

#제출 시각아이디문제언어결과실행 시간메모리
976615rakhim_ova사이버랜드 (APIO23_cyberland)C++17
0 / 100
19 ms2056 KiB
#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; if(m==0) return -1; if(m==2 && ((x[0]!=0 && x[1]!=0 && y[0]!=0 && y[1]!=0) || (x[0]!=h && x[1]!=h && y[0]!=h && y[1]!=h))) return -1; if(n==2 || m==1){ return c[0]; } if(x[0]==0 && y[0]==h){ return c[0]; } if(x[1]==0 && y[1]==h){ return c[1]; } if(x[0]==h && y[0]==0){ return c[0]; } if(x[1]==h && y[1]==0){ return c[1]; } if(x[0]>y[0]) swap(x[0], y[0]); if(x[1]>y[1]) swap(x[1], y[1]); if(x[0]==0){ if(x[1]==y[0] && y[1]==h){ if(arr[y[0]]==0){ return c[1]; } else if(arr[y[0]]==1){ return c[0]+c[1]; } else{ double res; if(k>0){ res=(double)c[1]/2+c[0];; } else{ res=c[1]+c[0]; } return res; } } else{ if(arr[y[1]]==0){ return c[1]; } else if(arr[y[1]]==1){ return c[0]+c[1]; } else{ double res; if(k>0){ res=(double)c[1]/2+c[0];; } else{ res=c[1]+c[0]; } return res; } } } else{ if(x[0]==y[1] && y[0]==h){ if(arr[y[1]]==0){ return c[0]; } else if(arr[y[1]]==1){ return c[0]+c[1]; } else{ double res; if(k>0){ res=(double)c[1]/2+c[0];; } else{ res=c[1]+c[0]; } return res; } } else{ if(arr[y[0]]==0){ return c[0]; } else if(arr[y[0]]==1){ return c[0]+c[1]; } else{ double res; if(k>0){ res=(double)c[1]/2+c[0];; } else{ res=c[1]+c[0]; } return res; } } } return -1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...