제출 #799555

#제출 시각아이디문제언어결과실행 시간메모리
799555vjudge1Wish (LMIO19_noras)C++17
0 / 100
2 ms484 KiB
#include <iostream> #include <cmath> #include <iomanip> using namespace std; int a[200005], b[200005], c[200005], d[200005], x[200005]; int main() { int n, r, flag = 0; cin >> n >> r; for (int i = 1; i <= n; i++) { cin >> a[i] >> b[i] >> c[i] >> d[i]; if (b[i] != d[i]) { flag = 1; } } for (int i = 1; i <= n; i++) { if (a[i] == c[i]) { swap(a[i], b[i]); swap(c[i], d[i]); } if (b[i] == d[i]) { if (b[i] > r) continue; double h = sqrt(r * r - b[i] * b[i]); if (a[i] > h && c[i] > a[i]) continue; if (a[i] < -h && c[i] < a[i]) continue; if (a[i] < -h && c[i] > h) continue; if (a[i] <= -h) { double k = (-h - a[i]) / (c[i] - a[i]); int l = (int)k; if (l * (c[i] - a[i]) != -h - a[i]) l++; double kk = (h - a[i]) / (c[i] - a[i]); int ll = (int)kk; x[l]++; x[ll + 1]--; } else if (a[i] >= h) { double k = (a[i] - h) / (a[i] - c[i]); int l = (int)k; if (l * (a[i] - c[i]) != a[i] - h) l++; double kk = (a[i] + h) / (a[i] - c[i]); int ll = (int)kk; x[l]++; x[ll + 1]--; } else { if (c[i] > a[i]) { double kk = (h - a[i]) / (c[i] - a[i]); int ll = (int)kk; x[0]++; x[ll + 1]--; } else { double k = (a[i] - h) / (a[i] - c[i]); int l = (int)k; x[0]++; x[l + 1]--; } } continue; } double h = (double)(d[i] - b[i]) / (c[i] - a[i]), k = b[i] - h * a[i]; double A = h * h + 1, B = h * k * 2, C = k * k - r * r; if (B * B < 4 * A * C) continue; double xa = (-B + sqrt(B * B - 4 * A * C)) / (A * 2), xb = (-B - sqrt(B * B - 4 * A * C)) / (A * 2); double xx = (a[i] - xa) / (a[i] - c[i]), xxa = (a[i] - xb) / (a[i] - c[i]); int l = (int)xx, ll = (int)xxa; if (l * (a[i] - c[i]) != (a[i] - xa) && a[i] > xa) l++; if (ll * (a[i] - c[i]) != (a[i] - xb) && a[i] < xxa) ll++; if (l < 0 || ll < 0) continue; x[l]++; x[ll + 1]--; } int c = x[0], ma = c; for (int i = 1; i <= 100000; i++) { c += x[i]; ma = max(ma, c); } cout << ma; }

컴파일 시 표준 에러 (stderr) 메시지

noras.cpp: In function 'int main()':
noras.cpp:7:15: warning: variable 'flag' set but not used [-Wunused-but-set-variable]
    7 |     int n, r, flag = 0;
      |               ^~~~
#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...