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>
// 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;
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> r;
for(int i = 1; i <= n; i++)
{
ld x1, x2, y1, y2;
cin >> x1 >> y1 >> x2 >> y2;
x2 -= x1;
y2 -= y1;
ld a = x2 * x2 + y2 * y2;
ld b = 2 * (x1 * x2 + y1 * y2);
ld c = x1 * x1 + y1 * y1 - r * r;
ld d = b * b - 4 * a * c;
if(d < 0)continue;
ld x = (- b - sqrtl(d)) / (2 * a);
ld y = (- b + sqrtl(d)) / (2 * a);
int xi = ceil(x);
int yi = floor(y);
if(xi > yi || yi < 0)continue;
v.push_back({max(xi, 0LL), 1});
v.push_back({yi + 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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |