Submission #965287

# Submission time Handle Problem Language Result Execution time Memory
965287 2024-04-18T09:34:08 Z AtabayRajabli Wish (LMIO19_noras) C++17
93 / 100
236 ms 10552 KB
#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
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 500 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 504 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 1 ms 344 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 344 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 500 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 504 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 1 ms 344 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 344 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 2 ms 348 KB Output is correct
23 Correct 105 ms 5592 KB Output is correct
24 Correct 93 ms 6232 KB Output is correct
25 Correct 98 ms 4748 KB Output is correct
26 Correct 103 ms 5964 KB Output is correct
27 Correct 97 ms 2576 KB Output is correct
28 Correct 91 ms 5980 KB Output is correct
29 Correct 107 ms 4644 KB Output is correct
30 Correct 99 ms 5504 KB Output is correct
31 Correct 98 ms 6256 KB Output is correct
32 Correct 114 ms 5712 KB Output is correct
33 Correct 127 ms 6252 KB Output is correct
34 Correct 98 ms 5828 KB Output is correct
35 Correct 96 ms 4684 KB Output is correct
36 Correct 111 ms 4812 KB Output is correct
37 Correct 85 ms 2612 KB Output is correct
38 Correct 100 ms 2500 KB Output is correct
39 Correct 101 ms 2416 KB Output is correct
40 Correct 101 ms 2544 KB Output is correct
41 Correct 103 ms 2452 KB Output is correct
42 Correct 96 ms 2616 KB Output is correct
43 Correct 221 ms 8892 KB Output is correct
44 Correct 230 ms 9784 KB Output is correct
45 Correct 206 ms 10244 KB Output is correct
46 Correct 220 ms 8896 KB Output is correct
47 Correct 205 ms 9620 KB Output is correct
48 Correct 205 ms 10524 KB Output is correct
49 Correct 213 ms 9408 KB Output is correct
50 Correct 220 ms 10472 KB Output is correct
51 Correct 234 ms 10552 KB Output is correct
52 Correct 236 ms 10260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 500 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 504 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 1 ms 344 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 344 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 2 ms 348 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 2 ms 508 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 1 ms 344 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 2 ms 756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 500 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 504 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 1 ms 344 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 344 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 2 ms 348 KB Output is correct
23 Correct 105 ms 5592 KB Output is correct
24 Correct 93 ms 6232 KB Output is correct
25 Correct 98 ms 4748 KB Output is correct
26 Correct 103 ms 5964 KB Output is correct
27 Correct 97 ms 2576 KB Output is correct
28 Correct 91 ms 5980 KB Output is correct
29 Correct 107 ms 4644 KB Output is correct
30 Correct 99 ms 5504 KB Output is correct
31 Correct 98 ms 6256 KB Output is correct
32 Correct 114 ms 5712 KB Output is correct
33 Correct 127 ms 6252 KB Output is correct
34 Correct 98 ms 5828 KB Output is correct
35 Correct 96 ms 4684 KB Output is correct
36 Correct 111 ms 4812 KB Output is correct
37 Correct 85 ms 2612 KB Output is correct
38 Correct 100 ms 2500 KB Output is correct
39 Correct 101 ms 2416 KB Output is correct
40 Correct 101 ms 2544 KB Output is correct
41 Correct 103 ms 2452 KB Output is correct
42 Correct 96 ms 2616 KB Output is correct
43 Correct 221 ms 8892 KB Output is correct
44 Correct 230 ms 9784 KB Output is correct
45 Correct 206 ms 10244 KB Output is correct
46 Correct 220 ms 8896 KB Output is correct
47 Correct 205 ms 9620 KB Output is correct
48 Correct 205 ms 10524 KB Output is correct
49 Correct 213 ms 9408 KB Output is correct
50 Correct 220 ms 10472 KB Output is correct
51 Correct 234 ms 10552 KB Output is correct
52 Correct 236 ms 10260 KB Output is correct
53 Correct 1 ms 344 KB Output is correct
54 Correct 2 ms 508 KB Output is correct
55 Correct 1 ms 344 KB Output is correct
56 Correct 1 ms 344 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 2 ms 756 KB Output is correct
59 Correct 91 ms 6396 KB Output is correct
60 Correct 88 ms 2584 KB Output is correct
61 Correct 104 ms 2508 KB Output is correct
62 Correct 99 ms 2640 KB Output is correct
63 Correct 95 ms 2504 KB Output is correct
64 Correct 91 ms 2480 KB Output is correct
65 Correct 102 ms 2508 KB Output is correct
66 Correct 111 ms 2432 KB Output is correct
67 Correct 97 ms 2628 KB Output is correct
68 Correct 101 ms 6156 KB Output is correct
69 Correct 109 ms 4832 KB Output is correct
70 Correct 108 ms 5996 KB Output is correct
71 Correct 100 ms 4548 KB Output is correct
72 Correct 107 ms 4980 KB Output is correct
73 Correct 100 ms 2508 KB Output is correct
74 Correct 99 ms 6136 KB Output is correct
75 Correct 97 ms 5040 KB Output is correct
76 Correct 96 ms 2480 KB Output is correct
77 Correct 213 ms 9428 KB Output is correct
78 Correct 209 ms 9920 KB Output is correct
79 Correct 207 ms 9408 KB Output is correct
80 Correct 227 ms 10420 KB Output is correct
81 Correct 218 ms 10212 KB Output is correct
82 Correct 224 ms 9660 KB Output is correct
83 Correct 214 ms 9788 KB Output is correct
84 Correct 208 ms 8892 KB Output is correct
85 Correct 218 ms 8972 KB Output is correct
86 Correct 233 ms 10176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 500 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 504 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 1 ms 344 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 344 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 2 ms 348 KB Output is correct
23 Correct 105 ms 5592 KB Output is correct
24 Correct 93 ms 6232 KB Output is correct
25 Correct 98 ms 4748 KB Output is correct
26 Correct 103 ms 5964 KB Output is correct
27 Correct 97 ms 2576 KB Output is correct
28 Correct 91 ms 5980 KB Output is correct
29 Correct 107 ms 4644 KB Output is correct
30 Correct 99 ms 5504 KB Output is correct
31 Correct 98 ms 6256 KB Output is correct
32 Correct 114 ms 5712 KB Output is correct
33 Correct 127 ms 6252 KB Output is correct
34 Correct 98 ms 5828 KB Output is correct
35 Correct 96 ms 4684 KB Output is correct
36 Correct 111 ms 4812 KB Output is correct
37 Correct 85 ms 2612 KB Output is correct
38 Correct 100 ms 2500 KB Output is correct
39 Correct 101 ms 2416 KB Output is correct
40 Correct 101 ms 2544 KB Output is correct
41 Correct 103 ms 2452 KB Output is correct
42 Correct 96 ms 2616 KB Output is correct
43 Correct 221 ms 8892 KB Output is correct
44 Correct 230 ms 9784 KB Output is correct
45 Correct 206 ms 10244 KB Output is correct
46 Correct 220 ms 8896 KB Output is correct
47 Correct 205 ms 9620 KB Output is correct
48 Correct 205 ms 10524 KB Output is correct
49 Correct 213 ms 9408 KB Output is correct
50 Correct 220 ms 10472 KB Output is correct
51 Correct 234 ms 10552 KB Output is correct
52 Correct 236 ms 10260 KB Output is correct
53 Correct 91 ms 6396 KB Output is correct
54 Correct 88 ms 2584 KB Output is correct
55 Correct 104 ms 2508 KB Output is correct
56 Correct 99 ms 2640 KB Output is correct
57 Correct 95 ms 2504 KB Output is correct
58 Correct 91 ms 2480 KB Output is correct
59 Correct 102 ms 2508 KB Output is correct
60 Correct 111 ms 2432 KB Output is correct
61 Correct 97 ms 2628 KB Output is correct
62 Correct 101 ms 6156 KB Output is correct
63 Correct 109 ms 4832 KB Output is correct
64 Correct 108 ms 5996 KB Output is correct
65 Correct 100 ms 4548 KB Output is correct
66 Correct 107 ms 4980 KB Output is correct
67 Correct 100 ms 2508 KB Output is correct
68 Correct 99 ms 6136 KB Output is correct
69 Correct 97 ms 5040 KB Output is correct
70 Correct 96 ms 2480 KB Output is correct
71 Correct 213 ms 9428 KB Output is correct
72 Correct 209 ms 9920 KB Output is correct
73 Correct 207 ms 9408 KB Output is correct
74 Correct 227 ms 10420 KB Output is correct
75 Correct 218 ms 10212 KB Output is correct
76 Correct 224 ms 9660 KB Output is correct
77 Correct 214 ms 9788 KB Output is correct
78 Correct 208 ms 8892 KB Output is correct
79 Correct 218 ms 8972 KB Output is correct
80 Correct 233 ms 10176 KB Output is correct
81 Correct 1 ms 344 KB Output is correct
82 Correct 2 ms 508 KB Output is correct
83 Correct 1 ms 344 KB Output is correct
84 Correct 1 ms 344 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 2 ms 756 KB Output is correct
87 Correct 121 ms 2620 KB Output is correct
88 Correct 113 ms 2480 KB Output is correct
89 Correct 111 ms 2512 KB Output is correct
90 Correct 115 ms 2648 KB Output is correct
91 Correct 107 ms 2644 KB Output is correct
92 Correct 109 ms 2604 KB Output is correct
93 Correct 116 ms 2492 KB Output is correct
94 Correct 104 ms 2516 KB Output is correct
95 Correct 105 ms 2432 KB Output is correct
96 Correct 104 ms 2512 KB Output is correct
97 Correct 96 ms 6088 KB Output is correct
98 Incorrect 124 ms 2508 KB Output isn't correct
99 Halted 0 ms 0 KB -