제출 #965278

#제출 시각아이디문제언어결과실행 시간메모리
965278AtabayRajabliWish (LMIO19_noras)C++17
93 / 100
124 ms10724 KiB
#include <bits/stdc++.h> // author : a1abay #define all(v) v.begin(), v.end() #define GCD(a, b) __gcd(a, b) #define LCM(a, b) (a*b / (__gcd(a, b))) #define int ll typedef long long ll; typedef long double ld; const int inf = 1e9 + 7; const int inff = (int)1e18 + 7; const int sz = 2e5 + 5; using namespace std; int n; ld r; vector<array<int, 2>> v; ld disc(ld a, ld b, ld c) { return b * b - 4 * a * c; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> r; for(int i = 1; i <= n; i++) { int a, b, c, d; cin >> a >> b >> c >> d; c -= a; d -= b; ld ds = disc(c * c + d * d, 2 * a * c + 2 * b * d, a * a + b * b - r * r); if(ds < 0)continue; ld x1 = (-(2 * a * c + 2 * b * d) - sqrtl(ds)) / (2 * (c * c + d * d)); ld x2 = (-(2 * a * c + 2 * b * d) + sqrtl(ds)) / (2 * (c * c + d * d)); if(x2 < 0LL)continue; int x = ceil(x1); int y = floor(x2); x = max(x, 0LL); if(x > y)continue; v.push_back({x, 1}); v.push_back({y + 1, -1}); } int s = 0, mx = 0; sort(all(v)); for(auto i : v) { s += i[1]; mx = max(mx, s); } cout << mx; }
#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...