Submission #1020077

# Submission time Handle Problem Language Result Execution time Memory
1020077 2024-07-11T13:43:34 Z thinknoexit Wish (LMIO19_noras) C++17
100 / 100
150 ms 11712 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll R;
ll x, y, sx, sy;
ll d(ll x, ll y) {
    return x * x + y * y;
}
ll val(ll k) {
    return d(sx + x * k, sy + y * k);
}
int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int n;
    cin >> n >> R;
    R = R * R;
    vector<pair<ll, int>> v;
    for (int i = 1;i <= n;i++) {
        {
            int a, b, c, d;
            cin >> a >> b >> c >> d;
            x = c - a, y = d - b;
            sx = a - x, sy = b - y;
        }
        ll m;
        ll MX = 1e8 / max(abs(x), abs(y)) + 1;
        {
            ll l = 1, r = MX;
            while (l < r) {
                ll mid = (l + r + 1) / 2;
                if (val(mid) >= val(mid + 1))
                    l = mid;
                else
                    r = mid - 1;
            }
            m = l;
        }
        {
            ll l = 1, r = m + 1;
            while (l < r) {
                ll mid = (l + r) / 2;
                if (val(mid) <= R)
                    r = mid;
                else
                    l = mid + 1;
            }
            v.push_back({ l, 1 });
            //cout << l << ' ';
        }
        //cout << m << ' ';
        {
            ll l = m, r = MX;
            while (l < r) {
                ll mid = (l + r + 1) / 2;
                if (val(mid) <= R)
                    l = mid;
                else
                    r = mid - 1;
            }
            v.push_back({ l + 1, -1 });
            //cout << l << '\n';
        }
    }
    sort(v.begin(), v.end());
    int mx = 0;
    int now = 0;
    for (int i = 0, j;i < (int)v.size();i = j) {
        for (j = i;j < (int)v.size() && v[i].first == v[j].first;j++) now += v[j].second;
        mx = max(mx, now);
    }
    cout << mx;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 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 472 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 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 464 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 344 KB Output is correct
2 Correct 1 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 472 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 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 464 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 35 ms 5844 KB Output is correct
24 Correct 34 ms 5924 KB Output is correct
25 Correct 38 ms 5840 KB Output is correct
26 Correct 34 ms 5832 KB Output is correct
27 Correct 37 ms 5836 KB Output is correct
28 Correct 43 ms 5836 KB Output is correct
29 Correct 38 ms 5840 KB Output is correct
30 Correct 40 ms 5752 KB Output is correct
31 Correct 39 ms 5792 KB Output is correct
32 Correct 74 ms 6084 KB Output is correct
33 Correct 64 ms 5840 KB Output is correct
34 Correct 71 ms 5832 KB Output is correct
35 Correct 64 ms 5836 KB Output is correct
36 Correct 62 ms 6100 KB Output is correct
37 Correct 50 ms 5836 KB Output is correct
38 Correct 57 ms 5740 KB Output is correct
39 Correct 49 ms 5836 KB Output is correct
40 Correct 49 ms 5820 KB Output is correct
41 Correct 47 ms 5828 KB Output is correct
42 Correct 60 ms 5908 KB Output is correct
43 Correct 140 ms 11708 KB Output is correct
44 Correct 136 ms 11528 KB Output is correct
45 Correct 141 ms 11584 KB Output is correct
46 Correct 150 ms 11580 KB Output is correct
47 Correct 137 ms 11708 KB Output is correct
48 Correct 136 ms 11196 KB Output is correct
49 Correct 131 ms 11196 KB Output is correct
50 Correct 122 ms 11024 KB Output is correct
51 Correct 125 ms 11076 KB Output is correct
52 Correct 122 ms 11192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 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 472 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 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 464 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 468 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 528 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 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 472 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 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 464 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 35 ms 5844 KB Output is correct
24 Correct 34 ms 5924 KB Output is correct
25 Correct 38 ms 5840 KB Output is correct
26 Correct 34 ms 5832 KB Output is correct
27 Correct 37 ms 5836 KB Output is correct
28 Correct 43 ms 5836 KB Output is correct
29 Correct 38 ms 5840 KB Output is correct
30 Correct 40 ms 5752 KB Output is correct
31 Correct 39 ms 5792 KB Output is correct
32 Correct 74 ms 6084 KB Output is correct
33 Correct 64 ms 5840 KB Output is correct
34 Correct 71 ms 5832 KB Output is correct
35 Correct 64 ms 5836 KB Output is correct
36 Correct 62 ms 6100 KB Output is correct
37 Correct 50 ms 5836 KB Output is correct
38 Correct 57 ms 5740 KB Output is correct
39 Correct 49 ms 5836 KB Output is correct
40 Correct 49 ms 5820 KB Output is correct
41 Correct 47 ms 5828 KB Output is correct
42 Correct 60 ms 5908 KB Output is correct
43 Correct 140 ms 11708 KB Output is correct
44 Correct 136 ms 11528 KB Output is correct
45 Correct 141 ms 11584 KB Output is correct
46 Correct 150 ms 11580 KB Output is correct
47 Correct 137 ms 11708 KB Output is correct
48 Correct 136 ms 11196 KB Output is correct
49 Correct 131 ms 11196 KB Output is correct
50 Correct 122 ms 11024 KB Output is correct
51 Correct 125 ms 11076 KB Output is correct
52 Correct 122 ms 11192 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 468 KB Output is correct
56 Correct 1 ms 348 KB Output is correct
57 Correct 1 ms 528 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 36 ms 5840 KB Output is correct
60 Correct 51 ms 6088 KB Output is correct
61 Correct 41 ms 6112 KB Output is correct
62 Correct 41 ms 6100 KB Output is correct
63 Correct 61 ms 6100 KB Output is correct
64 Correct 57 ms 6092 KB Output is correct
65 Correct 57 ms 6204 KB Output is correct
66 Correct 60 ms 6172 KB Output is correct
67 Correct 60 ms 6132 KB Output is correct
68 Correct 66 ms 5920 KB Output is correct
69 Correct 65 ms 6088 KB Output is correct
70 Correct 71 ms 6088 KB Output is correct
71 Correct 60 ms 5896 KB Output is correct
72 Correct 61 ms 5828 KB Output is correct
73 Correct 47 ms 5712 KB Output is correct
74 Correct 47 ms 5908 KB Output is correct
75 Correct 47 ms 5924 KB Output is correct
76 Correct 53 ms 5840 KB Output is correct
77 Correct 131 ms 11668 KB Output is correct
78 Correct 131 ms 11712 KB Output is correct
79 Correct 131 ms 11620 KB Output is correct
80 Correct 133 ms 11708 KB Output is correct
81 Correct 135 ms 11708 KB Output is correct
82 Correct 129 ms 11316 KB Output is correct
83 Correct 132 ms 11380 KB Output is correct
84 Correct 123 ms 11456 KB Output is correct
85 Correct 124 ms 11368 KB Output is correct
86 Correct 123 ms 11348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 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 472 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 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 464 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 35 ms 5844 KB Output is correct
24 Correct 34 ms 5924 KB Output is correct
25 Correct 38 ms 5840 KB Output is correct
26 Correct 34 ms 5832 KB Output is correct
27 Correct 37 ms 5836 KB Output is correct
28 Correct 43 ms 5836 KB Output is correct
29 Correct 38 ms 5840 KB Output is correct
30 Correct 40 ms 5752 KB Output is correct
31 Correct 39 ms 5792 KB Output is correct
32 Correct 74 ms 6084 KB Output is correct
33 Correct 64 ms 5840 KB Output is correct
34 Correct 71 ms 5832 KB Output is correct
35 Correct 64 ms 5836 KB Output is correct
36 Correct 62 ms 6100 KB Output is correct
37 Correct 50 ms 5836 KB Output is correct
38 Correct 57 ms 5740 KB Output is correct
39 Correct 49 ms 5836 KB Output is correct
40 Correct 49 ms 5820 KB Output is correct
41 Correct 47 ms 5828 KB Output is correct
42 Correct 60 ms 5908 KB Output is correct
43 Correct 140 ms 11708 KB Output is correct
44 Correct 136 ms 11528 KB Output is correct
45 Correct 141 ms 11584 KB Output is correct
46 Correct 150 ms 11580 KB Output is correct
47 Correct 137 ms 11708 KB Output is correct
48 Correct 136 ms 11196 KB Output is correct
49 Correct 131 ms 11196 KB Output is correct
50 Correct 122 ms 11024 KB Output is correct
51 Correct 125 ms 11076 KB Output is correct
52 Correct 122 ms 11192 KB Output is correct
53 Correct 36 ms 5840 KB Output is correct
54 Correct 51 ms 6088 KB Output is correct
55 Correct 41 ms 6112 KB Output is correct
56 Correct 41 ms 6100 KB Output is correct
57 Correct 61 ms 6100 KB Output is correct
58 Correct 57 ms 6092 KB Output is correct
59 Correct 57 ms 6204 KB Output is correct
60 Correct 60 ms 6172 KB Output is correct
61 Correct 60 ms 6132 KB Output is correct
62 Correct 66 ms 5920 KB Output is correct
63 Correct 65 ms 6088 KB Output is correct
64 Correct 71 ms 6088 KB Output is correct
65 Correct 60 ms 5896 KB Output is correct
66 Correct 61 ms 5828 KB Output is correct
67 Correct 47 ms 5712 KB Output is correct
68 Correct 47 ms 5908 KB Output is correct
69 Correct 47 ms 5924 KB Output is correct
70 Correct 53 ms 5840 KB Output is correct
71 Correct 131 ms 11668 KB Output is correct
72 Correct 131 ms 11712 KB Output is correct
73 Correct 131 ms 11620 KB Output is correct
74 Correct 133 ms 11708 KB Output is correct
75 Correct 135 ms 11708 KB Output is correct
76 Correct 129 ms 11316 KB Output is correct
77 Correct 132 ms 11380 KB Output is correct
78 Correct 123 ms 11456 KB Output is correct
79 Correct 124 ms 11368 KB Output is correct
80 Correct 123 ms 11348 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 468 KB Output is correct
84 Correct 1 ms 348 KB Output is correct
85 Correct 1 ms 528 KB Output is correct
86 Correct 1 ms 344 KB Output is correct
87 Correct 70 ms 7316 KB Output is correct
88 Correct 62 ms 7216 KB Output is correct
89 Correct 62 ms 7112 KB Output is correct
90 Correct 62 ms 7360 KB Output is correct
91 Correct 57 ms 7124 KB Output is correct
92 Correct 77 ms 7372 KB Output is correct
93 Correct 70 ms 7112 KB Output is correct
94 Correct 71 ms 7112 KB Output is correct
95 Correct 73 ms 7284 KB Output is correct
96 Correct 74 ms 7112 KB Output is correct
97 Correct 30 ms 6356 KB Output is correct
98 Correct 30 ms 6344 KB Output is correct
99 Correct 31 ms 6284 KB Output is correct
100 Correct 31 ms 6352 KB Output is correct
101 Correct 30 ms 6600 KB Output is correct
102 Correct 31 ms 6352 KB Output is correct
103 Correct 32 ms 6236 KB Output is correct
104 Correct 31 ms 6420 KB Output is correct
105 Correct 38 ms 6348 KB Output is correct
106 Correct 31 ms 6352 KB Output is correct