# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
976612 | rakhim_ova | Cyberland (APIO23_cyberland) | C++17 | 17 ms | 2136 KiB |
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 "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)
# | 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... |