Submission #163884

#TimeUsernameProblemLanguageResultExecution timeMemory
163884arnold518Fences (JOI18_fences)C++14
0 / 100
2 ms376 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...