답안 #965237

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
965237 2024-04-18T08:46:54 Z AtabayRajabli Wish (LMIO19_noras) C++17
93 / 100
126 ms 10736 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 - 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);
        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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 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 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 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 600 KB Output is correct
17 Correct 1 ms 412 KB Output is correct
18 Correct 1 ms 600 KB Output is correct
19 Correct 1 ms 344 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 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 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 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 600 KB Output is correct
17 Correct 1 ms 412 KB Output is correct
18 Correct 1 ms 600 KB Output is correct
19 Correct 1 ms 344 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 39 ms 6676 KB Output is correct
24 Correct 38 ms 4820 KB Output is correct
25 Correct 38 ms 5588 KB Output is correct
26 Correct 37 ms 5260 KB Output is correct
27 Correct 31 ms 2520 KB Output is correct
28 Correct 41 ms 6612 KB Output is correct
29 Correct 40 ms 5072 KB Output is correct
30 Correct 40 ms 6100 KB Output is correct
31 Correct 43 ms 5876 KB Output is correct
32 Correct 50 ms 4808 KB Output is correct
33 Correct 52 ms 5316 KB Output is correct
34 Correct 52 ms 6096 KB Output is correct
35 Correct 52 ms 5324 KB Output is correct
36 Correct 56 ms 5328 KB Output is correct
37 Correct 36 ms 2520 KB Output is correct
38 Correct 37 ms 2544 KB Output is correct
39 Correct 32 ms 2512 KB Output is correct
40 Correct 35 ms 2576 KB Output is correct
41 Correct 32 ms 2520 KB Output is correct
42 Correct 33 ms 2392 KB Output is correct
43 Correct 126 ms 9052 KB Output is correct
44 Correct 122 ms 9412 KB Output is correct
45 Correct 122 ms 9160 KB Output is correct
46 Correct 122 ms 9916 KB Output is correct
47 Correct 123 ms 10728 KB Output is correct
48 Correct 102 ms 9504 KB Output is correct
49 Correct 103 ms 9900 KB Output is correct
50 Correct 101 ms 10432 KB Output is correct
51 Correct 107 ms 10232 KB Output is correct
52 Correct 100 ms 9520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 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 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 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 600 KB Output is correct
17 Correct 1 ms 412 KB Output is correct
18 Correct 1 ms 600 KB Output is correct
19 Correct 1 ms 344 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 344 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 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 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 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 600 KB Output is correct
17 Correct 1 ms 412 KB Output is correct
18 Correct 1 ms 600 KB Output is correct
19 Correct 1 ms 344 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 39 ms 6676 KB Output is correct
24 Correct 38 ms 4820 KB Output is correct
25 Correct 38 ms 5588 KB Output is correct
26 Correct 37 ms 5260 KB Output is correct
27 Correct 31 ms 2520 KB Output is correct
28 Correct 41 ms 6612 KB Output is correct
29 Correct 40 ms 5072 KB Output is correct
30 Correct 40 ms 6100 KB Output is correct
31 Correct 43 ms 5876 KB Output is correct
32 Correct 50 ms 4808 KB Output is correct
33 Correct 52 ms 5316 KB Output is correct
34 Correct 52 ms 6096 KB Output is correct
35 Correct 52 ms 5324 KB Output is correct
36 Correct 56 ms 5328 KB Output is correct
37 Correct 36 ms 2520 KB Output is correct
38 Correct 37 ms 2544 KB Output is correct
39 Correct 32 ms 2512 KB Output is correct
40 Correct 35 ms 2576 KB Output is correct
41 Correct 32 ms 2520 KB Output is correct
42 Correct 33 ms 2392 KB Output is correct
43 Correct 126 ms 9052 KB Output is correct
44 Correct 122 ms 9412 KB Output is correct
45 Correct 122 ms 9160 KB Output is correct
46 Correct 122 ms 9916 KB Output is correct
47 Correct 123 ms 10728 KB Output is correct
48 Correct 102 ms 9504 KB Output is correct
49 Correct 103 ms 9900 KB Output is correct
50 Correct 101 ms 10432 KB Output is correct
51 Correct 107 ms 10232 KB Output is correct
52 Correct 100 ms 9520 KB Output is correct
53 Correct 0 ms 344 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 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 35 ms 6100 KB Output is correct
60 Correct 39 ms 2512 KB Output is correct
61 Correct 37 ms 2520 KB Output is correct
62 Correct 38 ms 2520 KB Output is correct
63 Correct 42 ms 2512 KB Output is correct
64 Correct 42 ms 2508 KB Output is correct
65 Correct 42 ms 2636 KB Output is correct
66 Correct 47 ms 2516 KB Output is correct
67 Correct 41 ms 2600 KB Output is correct
68 Correct 60 ms 5576 KB Output is correct
69 Correct 61 ms 5212 KB Output is correct
70 Correct 59 ms 5076 KB Output is correct
71 Correct 60 ms 5832 KB Output is correct
72 Correct 72 ms 6248 KB Output is correct
73 Correct 37 ms 2516 KB Output is correct
74 Correct 45 ms 5224 KB Output is correct
75 Correct 52 ms 5324 KB Output is correct
76 Correct 42 ms 2508 KB Output is correct
77 Correct 94 ms 9664 KB Output is correct
78 Correct 93 ms 10712 KB Output is correct
79 Correct 92 ms 9596 KB Output is correct
80 Correct 91 ms 9152 KB Output is correct
81 Correct 105 ms 10380 KB Output is correct
82 Correct 119 ms 9908 KB Output is correct
83 Correct 121 ms 10736 KB Output is correct
84 Correct 116 ms 8852 KB Output is correct
85 Correct 121 ms 9152 KB Output is correct
86 Correct 125 ms 8788 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 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 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 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 600 KB Output is correct
17 Correct 1 ms 412 KB Output is correct
18 Correct 1 ms 600 KB Output is correct
19 Correct 1 ms 344 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 39 ms 6676 KB Output is correct
24 Correct 38 ms 4820 KB Output is correct
25 Correct 38 ms 5588 KB Output is correct
26 Correct 37 ms 5260 KB Output is correct
27 Correct 31 ms 2520 KB Output is correct
28 Correct 41 ms 6612 KB Output is correct
29 Correct 40 ms 5072 KB Output is correct
30 Correct 40 ms 6100 KB Output is correct
31 Correct 43 ms 5876 KB Output is correct
32 Correct 50 ms 4808 KB Output is correct
33 Correct 52 ms 5316 KB Output is correct
34 Correct 52 ms 6096 KB Output is correct
35 Correct 52 ms 5324 KB Output is correct
36 Correct 56 ms 5328 KB Output is correct
37 Correct 36 ms 2520 KB Output is correct
38 Correct 37 ms 2544 KB Output is correct
39 Correct 32 ms 2512 KB Output is correct
40 Correct 35 ms 2576 KB Output is correct
41 Correct 32 ms 2520 KB Output is correct
42 Correct 33 ms 2392 KB Output is correct
43 Correct 126 ms 9052 KB Output is correct
44 Correct 122 ms 9412 KB Output is correct
45 Correct 122 ms 9160 KB Output is correct
46 Correct 122 ms 9916 KB Output is correct
47 Correct 123 ms 10728 KB Output is correct
48 Correct 102 ms 9504 KB Output is correct
49 Correct 103 ms 9900 KB Output is correct
50 Correct 101 ms 10432 KB Output is correct
51 Correct 107 ms 10232 KB Output is correct
52 Correct 100 ms 9520 KB Output is correct
53 Correct 35 ms 6100 KB Output is correct
54 Correct 39 ms 2512 KB Output is correct
55 Correct 37 ms 2520 KB Output is correct
56 Correct 38 ms 2520 KB Output is correct
57 Correct 42 ms 2512 KB Output is correct
58 Correct 42 ms 2508 KB Output is correct
59 Correct 42 ms 2636 KB Output is correct
60 Correct 47 ms 2516 KB Output is correct
61 Correct 41 ms 2600 KB Output is correct
62 Correct 60 ms 5576 KB Output is correct
63 Correct 61 ms 5212 KB Output is correct
64 Correct 59 ms 5076 KB Output is correct
65 Correct 60 ms 5832 KB Output is correct
66 Correct 72 ms 6248 KB Output is correct
67 Correct 37 ms 2516 KB Output is correct
68 Correct 45 ms 5224 KB Output is correct
69 Correct 52 ms 5324 KB Output is correct
70 Correct 42 ms 2508 KB Output is correct
71 Correct 94 ms 9664 KB Output is correct
72 Correct 93 ms 10712 KB Output is correct
73 Correct 92 ms 9596 KB Output is correct
74 Correct 91 ms 9152 KB Output is correct
75 Correct 105 ms 10380 KB Output is correct
76 Correct 119 ms 9908 KB Output is correct
77 Correct 121 ms 10736 KB Output is correct
78 Correct 116 ms 8852 KB Output is correct
79 Correct 121 ms 9152 KB Output is correct
80 Correct 125 ms 8788 KB Output is correct
81 Correct 0 ms 344 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 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 49 ms 2496 KB Output isn't correct
88 Halted 0 ms 0 KB -