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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 100;
struct Line
{
int x1, y1, x2, y2;
};
int N, C;
Line line[MAXN+10];
double ans;
int main()
{
int i, j;
scanf("%d%d", &N, &C);
for(i=1; i<=N; i++) scanf("%d%d%d%d", &line[i].x1, &line[i].y1, &line[i].x2, &line[i].y2);
ans=C*8;
if(line[1].x1==C && line[1].x2==C) ans=min(ans, (double)C*8-min(C, max(line[1].y1, line[1].y2))+max(-C, min(line[1].y1, line[1].y2)));
if(line[1].y1==C && line[1].y2==C) ans=min(ans, (double)C*8-min(C, max(line[1].x1, line[1].x2))+max(-C, min(line[1].x1, line[1].x2)));
if(line[1].x1==-C && line[1].x2==-C) ans=min(ans, (double)C*8-min(C, max(line[1].y1, line[1].y2))+max(-C, min(line[1].y1, line[1].y2)));
if(line[1].y1==-C && line[1].y2==-C) ans=min(ans, (double)C*8-min(C, max(line[1].x1, line[1].x2))+max(-C, min(line[1].x1, line[1].x2)));
printf("%.10f", ans);
}
Compilation message (stderr)
fences.cpp: In function 'int main()':
fences.cpp:21:9: warning: unused variable 'j' [-Wunused-variable]
int i, j;
^
fences.cpp:22:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &N, &C);
~~~~~^~~~~~~~~~~~~~~~
fences.cpp:23:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
for(i=1; i<=N; i++) scanf("%d%d%d%d", &line[i].x1, &line[i].y1, &line[i].x2, &line[i].y2);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |