이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
}
컴파일 시 표준 에러 (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... |