Submission #965226

# Submission time Handle Problem Language Result Execution time Memory
965226 2024-04-18T08:39:52 Z AtabayRajabli Wish (LMIO19_noras) C++17
93 / 100
132 ms 13820 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;

int disc(int a, int b, int c)
{
    return b * b - 4 * a * c;
}

ld get(ld a, ld b, ld d)
{
    return (-b - sqrt(d)) / (2 * a);
}

ld get2(ld a, ld b, ld d)
{
    return (-b + sqrt(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);
        x1 = ceil(x1);
        x2 = floor(x2);
        if(x1 > x2 || x2 < 0)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 1 ms 348 KB Output is correct
2 Correct 0 ms 452 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 600 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 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 348 KB Output is correct
13 Correct 0 ms 348 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 1 ms 348 KB Output is correct
2 Correct 0 ms 452 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 600 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 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 348 KB Output is correct
13 Correct 0 ms 348 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 36 ms 6612 KB Output is correct
24 Correct 37 ms 7116 KB Output is correct
25 Correct 38 ms 7892 KB Output is correct
26 Correct 35 ms 7552 KB Output is correct
27 Correct 31 ms 3796 KB Output is correct
28 Correct 45 ms 6924 KB Output is correct
29 Correct 39 ms 7156 KB Output is correct
30 Correct 40 ms 7632 KB Output is correct
31 Correct 40 ms 7380 KB Output is correct
32 Correct 51 ms 6352 KB Output is correct
33 Correct 59 ms 6856 KB Output is correct
34 Correct 51 ms 6360 KB Output is correct
35 Correct 51 ms 6348 KB Output is correct
36 Correct 56 ms 7640 KB Output is correct
37 Correct 36 ms 4044 KB Output is correct
38 Correct 36 ms 4300 KB Output is correct
39 Correct 33 ms 4052 KB Output is correct
40 Correct 51 ms 3932 KB Output is correct
41 Correct 34 ms 4048 KB Output is correct
42 Correct 35 ms 4308 KB Output is correct
43 Correct 127 ms 11820 KB Output is correct
44 Correct 129 ms 12316 KB Output is correct
45 Correct 123 ms 12480 KB Output is correct
46 Correct 124 ms 12480 KB Output is correct
47 Correct 132 ms 12992 KB Output is correct
48 Correct 104 ms 12220 KB Output is correct
49 Correct 103 ms 12072 KB Output is correct
50 Correct 101 ms 12996 KB Output is correct
51 Correct 108 ms 11224 KB Output is correct
52 Correct 109 ms 12780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 452 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 600 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 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 348 KB Output is correct
13 Correct 0 ms 348 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 708 KB Output is correct
24 Correct 1 ms 544 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 1 ms 348 KB Output is correct
2 Correct 0 ms 452 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 600 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 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 348 KB Output is correct
13 Correct 0 ms 348 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 36 ms 6612 KB Output is correct
24 Correct 37 ms 7116 KB Output is correct
25 Correct 38 ms 7892 KB Output is correct
26 Correct 35 ms 7552 KB Output is correct
27 Correct 31 ms 3796 KB Output is correct
28 Correct 45 ms 6924 KB Output is correct
29 Correct 39 ms 7156 KB Output is correct
30 Correct 40 ms 7632 KB Output is correct
31 Correct 40 ms 7380 KB Output is correct
32 Correct 51 ms 6352 KB Output is correct
33 Correct 59 ms 6856 KB Output is correct
34 Correct 51 ms 6360 KB Output is correct
35 Correct 51 ms 6348 KB Output is correct
36 Correct 56 ms 7640 KB Output is correct
37 Correct 36 ms 4044 KB Output is correct
38 Correct 36 ms 4300 KB Output is correct
39 Correct 33 ms 4052 KB Output is correct
40 Correct 51 ms 3932 KB Output is correct
41 Correct 34 ms 4048 KB Output is correct
42 Correct 35 ms 4308 KB Output is correct
43 Correct 127 ms 11820 KB Output is correct
44 Correct 129 ms 12316 KB Output is correct
45 Correct 123 ms 12480 KB Output is correct
46 Correct 124 ms 12480 KB Output is correct
47 Correct 132 ms 12992 KB Output is correct
48 Correct 104 ms 12220 KB Output is correct
49 Correct 103 ms 12072 KB Output is correct
50 Correct 101 ms 12996 KB Output is correct
51 Correct 108 ms 11224 KB Output is correct
52 Correct 109 ms 12780 KB Output is correct
53 Correct 0 ms 708 KB Output is correct
54 Correct 1 ms 544 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 43 ms 7152 KB Output is correct
60 Correct 43 ms 4252 KB Output is correct
61 Correct 43 ms 4172 KB Output is correct
62 Correct 43 ms 4300 KB Output is correct
63 Correct 45 ms 4212 KB Output is correct
64 Correct 44 ms 4392 KB Output is correct
65 Correct 46 ms 4148 KB Output is correct
66 Correct 43 ms 4156 KB Output is correct
67 Correct 45 ms 4296 KB Output is correct
68 Correct 59 ms 7328 KB Output is correct
69 Correct 62 ms 6496 KB Output is correct
70 Correct 62 ms 7328 KB Output is correct
71 Correct 59 ms 6544 KB Output is correct
72 Correct 60 ms 6400 KB Output is correct
73 Correct 45 ms 3936 KB Output is correct
74 Correct 41 ms 6224 KB Output is correct
75 Correct 43 ms 7256 KB Output is correct
76 Correct 39 ms 3988 KB Output is correct
77 Correct 102 ms 12496 KB Output is correct
78 Correct 110 ms 13196 KB Output is correct
79 Correct 101 ms 13820 KB Output is correct
80 Correct 99 ms 12520 KB Output is correct
81 Correct 101 ms 12020 KB Output is correct
82 Correct 122 ms 11676 KB Output is correct
83 Correct 113 ms 11968 KB Output is correct
84 Correct 112 ms 12444 KB Output is correct
85 Correct 114 ms 12588 KB Output is correct
86 Correct 113 ms 12252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 452 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 600 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 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 348 KB Output is correct
13 Correct 0 ms 348 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 36 ms 6612 KB Output is correct
24 Correct 37 ms 7116 KB Output is correct
25 Correct 38 ms 7892 KB Output is correct
26 Correct 35 ms 7552 KB Output is correct
27 Correct 31 ms 3796 KB Output is correct
28 Correct 45 ms 6924 KB Output is correct
29 Correct 39 ms 7156 KB Output is correct
30 Correct 40 ms 7632 KB Output is correct
31 Correct 40 ms 7380 KB Output is correct
32 Correct 51 ms 6352 KB Output is correct
33 Correct 59 ms 6856 KB Output is correct
34 Correct 51 ms 6360 KB Output is correct
35 Correct 51 ms 6348 KB Output is correct
36 Correct 56 ms 7640 KB Output is correct
37 Correct 36 ms 4044 KB Output is correct
38 Correct 36 ms 4300 KB Output is correct
39 Correct 33 ms 4052 KB Output is correct
40 Correct 51 ms 3932 KB Output is correct
41 Correct 34 ms 4048 KB Output is correct
42 Correct 35 ms 4308 KB Output is correct
43 Correct 127 ms 11820 KB Output is correct
44 Correct 129 ms 12316 KB Output is correct
45 Correct 123 ms 12480 KB Output is correct
46 Correct 124 ms 12480 KB Output is correct
47 Correct 132 ms 12992 KB Output is correct
48 Correct 104 ms 12220 KB Output is correct
49 Correct 103 ms 12072 KB Output is correct
50 Correct 101 ms 12996 KB Output is correct
51 Correct 108 ms 11224 KB Output is correct
52 Correct 109 ms 12780 KB Output is correct
53 Correct 43 ms 7152 KB Output is correct
54 Correct 43 ms 4252 KB Output is correct
55 Correct 43 ms 4172 KB Output is correct
56 Correct 43 ms 4300 KB Output is correct
57 Correct 45 ms 4212 KB Output is correct
58 Correct 44 ms 4392 KB Output is correct
59 Correct 46 ms 4148 KB Output is correct
60 Correct 43 ms 4156 KB Output is correct
61 Correct 45 ms 4296 KB Output is correct
62 Correct 59 ms 7328 KB Output is correct
63 Correct 62 ms 6496 KB Output is correct
64 Correct 62 ms 7328 KB Output is correct
65 Correct 59 ms 6544 KB Output is correct
66 Correct 60 ms 6400 KB Output is correct
67 Correct 45 ms 3936 KB Output is correct
68 Correct 41 ms 6224 KB Output is correct
69 Correct 43 ms 7256 KB Output is correct
70 Correct 39 ms 3988 KB Output is correct
71 Correct 102 ms 12496 KB Output is correct
72 Correct 110 ms 13196 KB Output is correct
73 Correct 101 ms 13820 KB Output is correct
74 Correct 99 ms 12520 KB Output is correct
75 Correct 101 ms 12020 KB Output is correct
76 Correct 122 ms 11676 KB Output is correct
77 Correct 113 ms 11968 KB Output is correct
78 Correct 112 ms 12444 KB Output is correct
79 Correct 114 ms 12588 KB Output is correct
80 Correct 113 ms 12252 KB Output is correct
81 Correct 0 ms 708 KB Output is correct
82 Correct 1 ms 544 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 46 ms 5776 KB Output isn't correct
88 Halted 0 ms 0 KB -