Submission #976612

#TimeUsernameProblemLanguageResultExecution timeMemory
976612rakhim_ovaCyberland (APIO23_cyberland)C++17
0 / 100
17 ms2136 KiB
#include "cyberland.h" #include <vector> #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(m==0) 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=(double)c[0]/2+c[1]; 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=(double)c[0]/2+c[1]; 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=(double)c[1]/2+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=(double)c[1]/2+c[0]; return res; } } } return -1; }

Compilation message (stderr)

cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:13:19: warning: unused variable 'k' [-Wunused-variable]
   13 |     int n=N, m=M, k=K, h=H;
      |                   ^
#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...