#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 < 0LL)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 |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
504 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
612 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
2 ms |
344 KB |
Output is correct |
15 |
Correct |
2 ms |
348 KB |
Output is correct |
16 |
Correct |
2 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
2 ms |
348 KB |
Output is correct |
19 |
Correct |
2 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
504 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
612 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
2 ms |
344 KB |
Output is correct |
15 |
Correct |
2 ms |
348 KB |
Output is correct |
16 |
Correct |
2 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
2 ms |
348 KB |
Output is correct |
19 |
Correct |
2 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
2 ms |
348 KB |
Output is correct |
23 |
Correct |
98 ms |
4748 KB |
Output is correct |
24 |
Correct |
92 ms |
6028 KB |
Output is correct |
25 |
Correct |
99 ms |
5120 KB |
Output is correct |
26 |
Correct |
93 ms |
4912 KB |
Output is correct |
27 |
Correct |
102 ms |
2608 KB |
Output is correct |
28 |
Correct |
91 ms |
6512 KB |
Output is correct |
29 |
Correct |
96 ms |
6084 KB |
Output is correct |
30 |
Correct |
95 ms |
5516 KB |
Output is correct |
31 |
Correct |
91 ms |
5576 KB |
Output is correct |
32 |
Correct |
108 ms |
6384 KB |
Output is correct |
33 |
Correct |
98 ms |
4892 KB |
Output is correct |
34 |
Correct |
110 ms |
5828 KB |
Output is correct |
35 |
Correct |
113 ms |
6344 KB |
Output is correct |
36 |
Correct |
117 ms |
5704 KB |
Output is correct |
37 |
Correct |
105 ms |
2568 KB |
Output is correct |
38 |
Correct |
100 ms |
2488 KB |
Output is correct |
39 |
Correct |
90 ms |
2572 KB |
Output is correct |
40 |
Correct |
105 ms |
2528 KB |
Output is correct |
41 |
Correct |
87 ms |
2624 KB |
Output is correct |
42 |
Correct |
92 ms |
2508 KB |
Output is correct |
43 |
Correct |
232 ms |
9476 KB |
Output is correct |
44 |
Correct |
204 ms |
9916 KB |
Output is correct |
45 |
Correct |
214 ms |
10096 KB |
Output is correct |
46 |
Correct |
229 ms |
9376 KB |
Output is correct |
47 |
Correct |
207 ms |
9576 KB |
Output is correct |
48 |
Correct |
192 ms |
8896 KB |
Output is correct |
49 |
Correct |
204 ms |
9684 KB |
Output is correct |
50 |
Correct |
207 ms |
9744 KB |
Output is correct |
51 |
Correct |
228 ms |
9404 KB |
Output is correct |
52 |
Correct |
207 ms |
10300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
504 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
612 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
2 ms |
344 KB |
Output is correct |
15 |
Correct |
2 ms |
348 KB |
Output is correct |
16 |
Correct |
2 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
2 ms |
348 KB |
Output is correct |
19 |
Correct |
2 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
2 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
504 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
504 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
612 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
2 ms |
344 KB |
Output is correct |
15 |
Correct |
2 ms |
348 KB |
Output is correct |
16 |
Correct |
2 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
2 ms |
348 KB |
Output is correct |
19 |
Correct |
2 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
2 ms |
348 KB |
Output is correct |
23 |
Correct |
98 ms |
4748 KB |
Output is correct |
24 |
Correct |
92 ms |
6028 KB |
Output is correct |
25 |
Correct |
99 ms |
5120 KB |
Output is correct |
26 |
Correct |
93 ms |
4912 KB |
Output is correct |
27 |
Correct |
102 ms |
2608 KB |
Output is correct |
28 |
Correct |
91 ms |
6512 KB |
Output is correct |
29 |
Correct |
96 ms |
6084 KB |
Output is correct |
30 |
Correct |
95 ms |
5516 KB |
Output is correct |
31 |
Correct |
91 ms |
5576 KB |
Output is correct |
32 |
Correct |
108 ms |
6384 KB |
Output is correct |
33 |
Correct |
98 ms |
4892 KB |
Output is correct |
34 |
Correct |
110 ms |
5828 KB |
Output is correct |
35 |
Correct |
113 ms |
6344 KB |
Output is correct |
36 |
Correct |
117 ms |
5704 KB |
Output is correct |
37 |
Correct |
105 ms |
2568 KB |
Output is correct |
38 |
Correct |
100 ms |
2488 KB |
Output is correct |
39 |
Correct |
90 ms |
2572 KB |
Output is correct |
40 |
Correct |
105 ms |
2528 KB |
Output is correct |
41 |
Correct |
87 ms |
2624 KB |
Output is correct |
42 |
Correct |
92 ms |
2508 KB |
Output is correct |
43 |
Correct |
232 ms |
9476 KB |
Output is correct |
44 |
Correct |
204 ms |
9916 KB |
Output is correct |
45 |
Correct |
214 ms |
10096 KB |
Output is correct |
46 |
Correct |
229 ms |
9376 KB |
Output is correct |
47 |
Correct |
207 ms |
9576 KB |
Output is correct |
48 |
Correct |
192 ms |
8896 KB |
Output is correct |
49 |
Correct |
204 ms |
9684 KB |
Output is correct |
50 |
Correct |
207 ms |
9744 KB |
Output is correct |
51 |
Correct |
228 ms |
9404 KB |
Output is correct |
52 |
Correct |
207 ms |
10300 KB |
Output is correct |
53 |
Correct |
0 ms |
348 KB |
Output is correct |
54 |
Correct |
1 ms |
344 KB |
Output is correct |
55 |
Correct |
1 ms |
348 KB |
Output is correct |
56 |
Correct |
1 ms |
504 KB |
Output is correct |
57 |
Correct |
1 ms |
348 KB |
Output is correct |
58 |
Correct |
1 ms |
344 KB |
Output is correct |
59 |
Correct |
88 ms |
6428 KB |
Output is correct |
60 |
Correct |
87 ms |
2496 KB |
Output is correct |
61 |
Correct |
99 ms |
2648 KB |
Output is correct |
62 |
Correct |
97 ms |
2608 KB |
Output is correct |
63 |
Correct |
93 ms |
2628 KB |
Output is correct |
64 |
Correct |
93 ms |
3572 KB |
Output is correct |
65 |
Correct |
108 ms |
2476 KB |
Output is correct |
66 |
Correct |
102 ms |
2644 KB |
Output is correct |
67 |
Correct |
105 ms |
2392 KB |
Output is correct |
68 |
Correct |
104 ms |
6344 KB |
Output is correct |
69 |
Correct |
114 ms |
6604 KB |
Output is correct |
70 |
Correct |
109 ms |
6396 KB |
Output is correct |
71 |
Correct |
114 ms |
6088 KB |
Output is correct |
72 |
Correct |
105 ms |
6676 KB |
Output is correct |
73 |
Correct |
94 ms |
2580 KB |
Output is correct |
74 |
Correct |
91 ms |
6456 KB |
Output is correct |
75 |
Correct |
89 ms |
5832 KB |
Output is correct |
76 |
Correct |
96 ms |
2520 KB |
Output is correct |
77 |
Correct |
207 ms |
9676 KB |
Output is correct |
78 |
Correct |
221 ms |
9652 KB |
Output is correct |
79 |
Correct |
232 ms |
9000 KB |
Output is correct |
80 |
Correct |
201 ms |
9860 KB |
Output is correct |
81 |
Correct |
226 ms |
9352 KB |
Output is correct |
82 |
Correct |
228 ms |
10316 KB |
Output is correct |
83 |
Correct |
201 ms |
9168 KB |
Output is correct |
84 |
Correct |
210 ms |
8896 KB |
Output is correct |
85 |
Correct |
201 ms |
8896 KB |
Output is correct |
86 |
Correct |
216 ms |
10568 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
504 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
612 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
2 ms |
344 KB |
Output is correct |
15 |
Correct |
2 ms |
348 KB |
Output is correct |
16 |
Correct |
2 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
2 ms |
348 KB |
Output is correct |
19 |
Correct |
2 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
2 ms |
348 KB |
Output is correct |
23 |
Correct |
98 ms |
4748 KB |
Output is correct |
24 |
Correct |
92 ms |
6028 KB |
Output is correct |
25 |
Correct |
99 ms |
5120 KB |
Output is correct |
26 |
Correct |
93 ms |
4912 KB |
Output is correct |
27 |
Correct |
102 ms |
2608 KB |
Output is correct |
28 |
Correct |
91 ms |
6512 KB |
Output is correct |
29 |
Correct |
96 ms |
6084 KB |
Output is correct |
30 |
Correct |
95 ms |
5516 KB |
Output is correct |
31 |
Correct |
91 ms |
5576 KB |
Output is correct |
32 |
Correct |
108 ms |
6384 KB |
Output is correct |
33 |
Correct |
98 ms |
4892 KB |
Output is correct |
34 |
Correct |
110 ms |
5828 KB |
Output is correct |
35 |
Correct |
113 ms |
6344 KB |
Output is correct |
36 |
Correct |
117 ms |
5704 KB |
Output is correct |
37 |
Correct |
105 ms |
2568 KB |
Output is correct |
38 |
Correct |
100 ms |
2488 KB |
Output is correct |
39 |
Correct |
90 ms |
2572 KB |
Output is correct |
40 |
Correct |
105 ms |
2528 KB |
Output is correct |
41 |
Correct |
87 ms |
2624 KB |
Output is correct |
42 |
Correct |
92 ms |
2508 KB |
Output is correct |
43 |
Correct |
232 ms |
9476 KB |
Output is correct |
44 |
Correct |
204 ms |
9916 KB |
Output is correct |
45 |
Correct |
214 ms |
10096 KB |
Output is correct |
46 |
Correct |
229 ms |
9376 KB |
Output is correct |
47 |
Correct |
207 ms |
9576 KB |
Output is correct |
48 |
Correct |
192 ms |
8896 KB |
Output is correct |
49 |
Correct |
204 ms |
9684 KB |
Output is correct |
50 |
Correct |
207 ms |
9744 KB |
Output is correct |
51 |
Correct |
228 ms |
9404 KB |
Output is correct |
52 |
Correct |
207 ms |
10300 KB |
Output is correct |
53 |
Correct |
88 ms |
6428 KB |
Output is correct |
54 |
Correct |
87 ms |
2496 KB |
Output is correct |
55 |
Correct |
99 ms |
2648 KB |
Output is correct |
56 |
Correct |
97 ms |
2608 KB |
Output is correct |
57 |
Correct |
93 ms |
2628 KB |
Output is correct |
58 |
Correct |
93 ms |
3572 KB |
Output is correct |
59 |
Correct |
108 ms |
2476 KB |
Output is correct |
60 |
Correct |
102 ms |
2644 KB |
Output is correct |
61 |
Correct |
105 ms |
2392 KB |
Output is correct |
62 |
Correct |
104 ms |
6344 KB |
Output is correct |
63 |
Correct |
114 ms |
6604 KB |
Output is correct |
64 |
Correct |
109 ms |
6396 KB |
Output is correct |
65 |
Correct |
114 ms |
6088 KB |
Output is correct |
66 |
Correct |
105 ms |
6676 KB |
Output is correct |
67 |
Correct |
94 ms |
2580 KB |
Output is correct |
68 |
Correct |
91 ms |
6456 KB |
Output is correct |
69 |
Correct |
89 ms |
5832 KB |
Output is correct |
70 |
Correct |
96 ms |
2520 KB |
Output is correct |
71 |
Correct |
207 ms |
9676 KB |
Output is correct |
72 |
Correct |
221 ms |
9652 KB |
Output is correct |
73 |
Correct |
232 ms |
9000 KB |
Output is correct |
74 |
Correct |
201 ms |
9860 KB |
Output is correct |
75 |
Correct |
226 ms |
9352 KB |
Output is correct |
76 |
Correct |
228 ms |
10316 KB |
Output is correct |
77 |
Correct |
201 ms |
9168 KB |
Output is correct |
78 |
Correct |
210 ms |
8896 KB |
Output is correct |
79 |
Correct |
201 ms |
8896 KB |
Output is correct |
80 |
Correct |
216 ms |
10568 KB |
Output is correct |
81 |
Correct |
0 ms |
348 KB |
Output is correct |
82 |
Correct |
1 ms |
344 KB |
Output is correct |
83 |
Correct |
1 ms |
348 KB |
Output is correct |
84 |
Correct |
1 ms |
504 KB |
Output is correct |
85 |
Correct |
1 ms |
348 KB |
Output is correct |
86 |
Correct |
1 ms |
344 KB |
Output is correct |
87 |
Correct |
127 ms |
2408 KB |
Output is correct |
88 |
Correct |
105 ms |
2508 KB |
Output is correct |
89 |
Correct |
121 ms |
2536 KB |
Output is correct |
90 |
Correct |
105 ms |
2424 KB |
Output is correct |
91 |
Correct |
103 ms |
2528 KB |
Output is correct |
92 |
Correct |
99 ms |
2408 KB |
Output is correct |
93 |
Correct |
102 ms |
2452 KB |
Output is correct |
94 |
Correct |
103 ms |
2532 KB |
Output is correct |
95 |
Correct |
103 ms |
2460 KB |
Output is correct |
96 |
Correct |
109 ms |
2536 KB |
Output is correct |
97 |
Correct |
95 ms |
6692 KB |
Output is correct |
98 |
Incorrect |
106 ms |
2628 KB |
Output isn't correct |
99 |
Halted |
0 ms |
0 KB |
- |