#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;
}
ld get(ld a, ld b, ld d)
{
return (-b - sqrtl(d)) / (2 * a);
}
ld get2(ld a, ld b, ld d)
{
return (-b + sqrtl(d)) / (2 * a);
}
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;
int ds = disc(c * c + d * d, 2 * a * c + 2 * b * d, a * a + b * b - r * r);
if(ds < 0)continue;
ld x1 = get(c * c + d * d, 2 * a * c + 2 * b * d, ds);
ld x2 = get2(c * c + d * d, 2 * a * c + 2 * b * d, ds);
if(x1 > x2)swap(x1, x2);
if(x2 < 0)continue;
x1 = ceil(x1);
x2 = floor(x2);
if(x1 > x2)continue;
v.push_back({(int)x1, 1});
v.push_back({(int)x2 + 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 |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
352 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
356 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
352 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
356 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
42 ms |
6112 KB |
Output is correct |
24 |
Correct |
39 ms |
5060 KB |
Output is correct |
25 |
Correct |
38 ms |
5328 KB |
Output is correct |
26 |
Correct |
39 ms |
5784 KB |
Output is correct |
27 |
Correct |
33 ms |
2516 KB |
Output is correct |
28 |
Correct |
40 ms |
5332 KB |
Output is correct |
29 |
Correct |
42 ms |
5844 KB |
Output is correct |
30 |
Correct |
47 ms |
4564 KB |
Output is correct |
31 |
Correct |
43 ms |
5616 KB |
Output is correct |
32 |
Correct |
52 ms |
6132 KB |
Output is correct |
33 |
Correct |
49 ms |
6604 KB |
Output is correct |
34 |
Correct |
48 ms |
5668 KB |
Output is correct |
35 |
Correct |
49 ms |
5064 KB |
Output is correct |
36 |
Correct |
48 ms |
4704 KB |
Output is correct |
37 |
Correct |
36 ms |
2916 KB |
Output is correct |
38 |
Correct |
37 ms |
2528 KB |
Output is correct |
39 |
Correct |
39 ms |
2516 KB |
Output is correct |
40 |
Correct |
35 ms |
2520 KB |
Output is correct |
41 |
Correct |
35 ms |
2520 KB |
Output is correct |
42 |
Correct |
35 ms |
2520 KB |
Output is correct |
43 |
Correct |
108 ms |
9948 KB |
Output is correct |
44 |
Correct |
117 ms |
10688 KB |
Output is correct |
45 |
Correct |
108 ms |
10448 KB |
Output is correct |
46 |
Correct |
109 ms |
8804 KB |
Output is correct |
47 |
Correct |
116 ms |
8688 KB |
Output is correct |
48 |
Correct |
105 ms |
10432 KB |
Output is correct |
49 |
Correct |
100 ms |
9160 KB |
Output is correct |
50 |
Correct |
101 ms |
9360 KB |
Output is correct |
51 |
Correct |
97 ms |
10176 KB |
Output is correct |
52 |
Correct |
98 ms |
9976 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
352 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
356 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
352 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
356 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
42 ms |
6112 KB |
Output is correct |
24 |
Correct |
39 ms |
5060 KB |
Output is correct |
25 |
Correct |
38 ms |
5328 KB |
Output is correct |
26 |
Correct |
39 ms |
5784 KB |
Output is correct |
27 |
Correct |
33 ms |
2516 KB |
Output is correct |
28 |
Correct |
40 ms |
5332 KB |
Output is correct |
29 |
Correct |
42 ms |
5844 KB |
Output is correct |
30 |
Correct |
47 ms |
4564 KB |
Output is correct |
31 |
Correct |
43 ms |
5616 KB |
Output is correct |
32 |
Correct |
52 ms |
6132 KB |
Output is correct |
33 |
Correct |
49 ms |
6604 KB |
Output is correct |
34 |
Correct |
48 ms |
5668 KB |
Output is correct |
35 |
Correct |
49 ms |
5064 KB |
Output is correct |
36 |
Correct |
48 ms |
4704 KB |
Output is correct |
37 |
Correct |
36 ms |
2916 KB |
Output is correct |
38 |
Correct |
37 ms |
2528 KB |
Output is correct |
39 |
Correct |
39 ms |
2516 KB |
Output is correct |
40 |
Correct |
35 ms |
2520 KB |
Output is correct |
41 |
Correct |
35 ms |
2520 KB |
Output is correct |
42 |
Correct |
35 ms |
2520 KB |
Output is correct |
43 |
Correct |
108 ms |
9948 KB |
Output is correct |
44 |
Correct |
117 ms |
10688 KB |
Output is correct |
45 |
Correct |
108 ms |
10448 KB |
Output is correct |
46 |
Correct |
109 ms |
8804 KB |
Output is correct |
47 |
Correct |
116 ms |
8688 KB |
Output is correct |
48 |
Correct |
105 ms |
10432 KB |
Output is correct |
49 |
Correct |
100 ms |
9160 KB |
Output is correct |
50 |
Correct |
101 ms |
9360 KB |
Output is correct |
51 |
Correct |
97 ms |
10176 KB |
Output is correct |
52 |
Correct |
98 ms |
9976 KB |
Output is correct |
53 |
Correct |
0 ms |
344 KB |
Output is correct |
54 |
Correct |
1 ms |
348 KB |
Output is correct |
55 |
Correct |
1 ms |
348 KB |
Output is correct |
56 |
Correct |
1 ms |
348 KB |
Output is correct |
57 |
Correct |
1 ms |
348 KB |
Output is correct |
58 |
Correct |
1 ms |
348 KB |
Output is correct |
59 |
Correct |
41 ms |
4820 KB |
Output is correct |
60 |
Correct |
37 ms |
2512 KB |
Output is correct |
61 |
Correct |
38 ms |
2516 KB |
Output is correct |
62 |
Correct |
40 ms |
2512 KB |
Output is correct |
63 |
Correct |
40 ms |
2496 KB |
Output is correct |
64 |
Correct |
39 ms |
2520 KB |
Output is correct |
65 |
Correct |
42 ms |
2516 KB |
Output is correct |
66 |
Correct |
41 ms |
2560 KB |
Output is correct |
67 |
Correct |
39 ms |
2512 KB |
Output is correct |
68 |
Correct |
58 ms |
6100 KB |
Output is correct |
69 |
Correct |
52 ms |
6044 KB |
Output is correct |
70 |
Correct |
53 ms |
6408 KB |
Output is correct |
71 |
Correct |
56 ms |
5328 KB |
Output is correct |
72 |
Correct |
56 ms |
5840 KB |
Output is correct |
73 |
Correct |
37 ms |
2512 KB |
Output is correct |
74 |
Correct |
38 ms |
6356 KB |
Output is correct |
75 |
Correct |
42 ms |
6100 KB |
Output is correct |
76 |
Correct |
37 ms |
2520 KB |
Output is correct |
77 |
Correct |
108 ms |
8776 KB |
Output is correct |
78 |
Correct |
114 ms |
8992 KB |
Output is correct |
79 |
Correct |
106 ms |
8588 KB |
Output is correct |
80 |
Correct |
106 ms |
9936 KB |
Output is correct |
81 |
Correct |
110 ms |
10468 KB |
Output is correct |
82 |
Correct |
103 ms |
10452 KB |
Output is correct |
83 |
Correct |
105 ms |
9412 KB |
Output is correct |
84 |
Correct |
103 ms |
10436 KB |
Output is correct |
85 |
Correct |
102 ms |
9668 KB |
Output is correct |
86 |
Correct |
103 ms |
9412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
352 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
356 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
42 ms |
6112 KB |
Output is correct |
24 |
Correct |
39 ms |
5060 KB |
Output is correct |
25 |
Correct |
38 ms |
5328 KB |
Output is correct |
26 |
Correct |
39 ms |
5784 KB |
Output is correct |
27 |
Correct |
33 ms |
2516 KB |
Output is correct |
28 |
Correct |
40 ms |
5332 KB |
Output is correct |
29 |
Correct |
42 ms |
5844 KB |
Output is correct |
30 |
Correct |
47 ms |
4564 KB |
Output is correct |
31 |
Correct |
43 ms |
5616 KB |
Output is correct |
32 |
Correct |
52 ms |
6132 KB |
Output is correct |
33 |
Correct |
49 ms |
6604 KB |
Output is correct |
34 |
Correct |
48 ms |
5668 KB |
Output is correct |
35 |
Correct |
49 ms |
5064 KB |
Output is correct |
36 |
Correct |
48 ms |
4704 KB |
Output is correct |
37 |
Correct |
36 ms |
2916 KB |
Output is correct |
38 |
Correct |
37 ms |
2528 KB |
Output is correct |
39 |
Correct |
39 ms |
2516 KB |
Output is correct |
40 |
Correct |
35 ms |
2520 KB |
Output is correct |
41 |
Correct |
35 ms |
2520 KB |
Output is correct |
42 |
Correct |
35 ms |
2520 KB |
Output is correct |
43 |
Correct |
108 ms |
9948 KB |
Output is correct |
44 |
Correct |
117 ms |
10688 KB |
Output is correct |
45 |
Correct |
108 ms |
10448 KB |
Output is correct |
46 |
Correct |
109 ms |
8804 KB |
Output is correct |
47 |
Correct |
116 ms |
8688 KB |
Output is correct |
48 |
Correct |
105 ms |
10432 KB |
Output is correct |
49 |
Correct |
100 ms |
9160 KB |
Output is correct |
50 |
Correct |
101 ms |
9360 KB |
Output is correct |
51 |
Correct |
97 ms |
10176 KB |
Output is correct |
52 |
Correct |
98 ms |
9976 KB |
Output is correct |
53 |
Correct |
41 ms |
4820 KB |
Output is correct |
54 |
Correct |
37 ms |
2512 KB |
Output is correct |
55 |
Correct |
38 ms |
2516 KB |
Output is correct |
56 |
Correct |
40 ms |
2512 KB |
Output is correct |
57 |
Correct |
40 ms |
2496 KB |
Output is correct |
58 |
Correct |
39 ms |
2520 KB |
Output is correct |
59 |
Correct |
42 ms |
2516 KB |
Output is correct |
60 |
Correct |
41 ms |
2560 KB |
Output is correct |
61 |
Correct |
39 ms |
2512 KB |
Output is correct |
62 |
Correct |
58 ms |
6100 KB |
Output is correct |
63 |
Correct |
52 ms |
6044 KB |
Output is correct |
64 |
Correct |
53 ms |
6408 KB |
Output is correct |
65 |
Correct |
56 ms |
5328 KB |
Output is correct |
66 |
Correct |
56 ms |
5840 KB |
Output is correct |
67 |
Correct |
37 ms |
2512 KB |
Output is correct |
68 |
Correct |
38 ms |
6356 KB |
Output is correct |
69 |
Correct |
42 ms |
6100 KB |
Output is correct |
70 |
Correct |
37 ms |
2520 KB |
Output is correct |
71 |
Correct |
108 ms |
8776 KB |
Output is correct |
72 |
Correct |
114 ms |
8992 KB |
Output is correct |
73 |
Correct |
106 ms |
8588 KB |
Output is correct |
74 |
Correct |
106 ms |
9936 KB |
Output is correct |
75 |
Correct |
110 ms |
10468 KB |
Output is correct |
76 |
Correct |
103 ms |
10452 KB |
Output is correct |
77 |
Correct |
105 ms |
9412 KB |
Output is correct |
78 |
Correct |
103 ms |
10436 KB |
Output is correct |
79 |
Correct |
102 ms |
9668 KB |
Output is correct |
80 |
Correct |
103 ms |
9412 KB |
Output is correct |
81 |
Correct |
0 ms |
344 KB |
Output is correct |
82 |
Correct |
1 ms |
348 KB |
Output is correct |
83 |
Correct |
1 ms |
348 KB |
Output is correct |
84 |
Correct |
1 ms |
348 KB |
Output is correct |
85 |
Correct |
1 ms |
348 KB |
Output is correct |
86 |
Correct |
1 ms |
348 KB |
Output is correct |
87 |
Incorrect |
43 ms |
2520 KB |
Output isn't correct |
88 |
Halted |
0 ms |
0 KB |
- |