답안 #199924

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
199924 2020-02-04T05:49:55 Z SamAnd Wish (LMIO19_noras) C++17
100 / 100
155 ms 18224 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
struct ban
{
    long long x;
    int z;
    ban(){}
    ban(long long x, int z)
    {
        this->x = x;
        this->z = z;
    }
};
bool operator<(const ban& a, const ban& b)
{
    if (a.x < b.x)
        return true;
    if (a.x > b.x)
        return false;
    return a.z < b.z;
}

int n;
long long R;
long long a[N], b[N], c[N], d[N];

long long l[N], r[N];

int main()
{
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin >> n >> R;
    for (int i = 1; i <= n; ++i)
        r[i] = -1;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        c[i] -= a[i];
        d[i] -= b[i];
        long double aa = c[i] * c[i] + d[i] * d[i];
        long double bb = 2 * a[i] * c[i] + 2 * b[i] * d[i];
        long double cc = a[i] * a[i] + b[i] * b[i] - R * R;
        long double D = bb * bb - 4 * aa * cc;
        D += 0.1;
        if (D < 0)
        {
            continue;
        }
        long double ll = (-sqrt(D) - bb) / (2 * aa);
        long double rr = (sqrt(D) - bb) / (2 * aa);
        for (long long k = ll - 5; k <= ll + 5; ++k)
        {
            if ((a[i] + c[i] * k) * (a[i] + c[i] * k) + (b[i] + d[i] * k) * (b[i] + d[i] * k) <= R * R)
            {
                l[i] = k;
                break;
            }
        }
        for (long long k = rr + 5; k >= rr - 5; --k)
        {
            if ((a[i] + c[i] * k) * (a[i] + c[i] * k) + (b[i] + d[i] * k) * (b[i] + d[i] * k) <= R * R)
            {
                r[i] = k;
                break;
            }
        }
        l[i] = max(l[i], 0LL);
        if (r[i] < l[i])
            r[i] = l[i] - 1;
    }
    vector<ban> v;
    for (int i = 1; i <= n; ++i)
    {
        v.push_back(ban(l[i], 1));
        v.push_back(ban(r[i] + 1, -1));
    }
    sort(v.begin(), v.end());
    int ans = 0;
    int yans = 0;
    for (int i = 0; i < v.size(); ++i)
    {
        yans += v[i].z;
        ans = max(ans, yans);
    }
    cout << ans << endl;
    return 0;
}

Compilation message

noras.cpp: In function 'int main()':
noras.cpp:82:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < v.size(); ++i)
                     ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 380 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 6 ms 504 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 5 ms 504 KB Output is correct
15 Correct 5 ms 504 KB Output is correct
16 Correct 5 ms 504 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 6 ms 504 KB Output is correct
19 Correct 5 ms 504 KB Output is correct
20 Correct 5 ms 504 KB Output is correct
21 Correct 5 ms 504 KB Output is correct
22 Correct 7 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 380 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 6 ms 504 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 5 ms 504 KB Output is correct
15 Correct 5 ms 504 KB Output is correct
16 Correct 5 ms 504 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 6 ms 504 KB Output is correct
19 Correct 5 ms 504 KB Output is correct
20 Correct 5 ms 504 KB Output is correct
21 Correct 5 ms 504 KB Output is correct
22 Correct 7 ms 504 KB Output is correct
23 Correct 63 ms 9448 KB Output is correct
24 Correct 62 ms 9320 KB Output is correct
25 Correct 62 ms 9320 KB Output is correct
26 Correct 61 ms 9320 KB Output is correct
27 Correct 66 ms 9320 KB Output is correct
28 Correct 64 ms 9320 KB Output is correct
29 Correct 64 ms 9324 KB Output is correct
30 Correct 65 ms 9320 KB Output is correct
31 Correct 63 ms 9320 KB Output is correct
32 Correct 74 ms 9320 KB Output is correct
33 Correct 70 ms 9324 KB Output is correct
34 Correct 74 ms 9444 KB Output is correct
35 Correct 74 ms 9324 KB Output is correct
36 Correct 74 ms 9320 KB Output is correct
37 Correct 64 ms 9320 KB Output is correct
38 Correct 68 ms 9320 KB Output is correct
39 Correct 64 ms 9320 KB Output is correct
40 Correct 63 ms 9320 KB Output is correct
41 Correct 65 ms 9320 KB Output is correct
42 Correct 65 ms 9316 KB Output is correct
43 Correct 153 ms 18016 KB Output is correct
44 Correct 151 ms 18144 KB Output is correct
45 Correct 143 ms 18144 KB Output is correct
46 Correct 152 ms 18016 KB Output is correct
47 Correct 155 ms 18148 KB Output is correct
48 Correct 149 ms 18144 KB Output is correct
49 Correct 143 ms 18144 KB Output is correct
50 Correct 144 ms 18012 KB Output is correct
51 Correct 145 ms 18148 KB Output is correct
52 Correct 146 ms 18148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 380 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 6 ms 504 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 5 ms 504 KB Output is correct
15 Correct 5 ms 504 KB Output is correct
16 Correct 5 ms 504 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 6 ms 504 KB Output is correct
19 Correct 5 ms 504 KB Output is correct
20 Correct 5 ms 504 KB Output is correct
21 Correct 5 ms 504 KB Output is correct
22 Correct 7 ms 504 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 5 ms 504 KB Output is correct
25 Correct 5 ms 504 KB Output is correct
26 Correct 5 ms 504 KB Output is correct
27 Correct 5 ms 504 KB Output is correct
28 Correct 5 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 380 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 6 ms 504 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 5 ms 504 KB Output is correct
15 Correct 5 ms 504 KB Output is correct
16 Correct 5 ms 504 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 6 ms 504 KB Output is correct
19 Correct 5 ms 504 KB Output is correct
20 Correct 5 ms 504 KB Output is correct
21 Correct 5 ms 504 KB Output is correct
22 Correct 7 ms 504 KB Output is correct
23 Correct 63 ms 9448 KB Output is correct
24 Correct 62 ms 9320 KB Output is correct
25 Correct 62 ms 9320 KB Output is correct
26 Correct 61 ms 9320 KB Output is correct
27 Correct 66 ms 9320 KB Output is correct
28 Correct 64 ms 9320 KB Output is correct
29 Correct 64 ms 9324 KB Output is correct
30 Correct 65 ms 9320 KB Output is correct
31 Correct 63 ms 9320 KB Output is correct
32 Correct 74 ms 9320 KB Output is correct
33 Correct 70 ms 9324 KB Output is correct
34 Correct 74 ms 9444 KB Output is correct
35 Correct 74 ms 9324 KB Output is correct
36 Correct 74 ms 9320 KB Output is correct
37 Correct 64 ms 9320 KB Output is correct
38 Correct 68 ms 9320 KB Output is correct
39 Correct 64 ms 9320 KB Output is correct
40 Correct 63 ms 9320 KB Output is correct
41 Correct 65 ms 9320 KB Output is correct
42 Correct 65 ms 9316 KB Output is correct
43 Correct 153 ms 18016 KB Output is correct
44 Correct 151 ms 18144 KB Output is correct
45 Correct 143 ms 18144 KB Output is correct
46 Correct 152 ms 18016 KB Output is correct
47 Correct 155 ms 18148 KB Output is correct
48 Correct 149 ms 18144 KB Output is correct
49 Correct 143 ms 18144 KB Output is correct
50 Correct 144 ms 18012 KB Output is correct
51 Correct 145 ms 18148 KB Output is correct
52 Correct 146 ms 18148 KB Output is correct
53 Correct 65 ms 9320 KB Output is correct
54 Correct 68 ms 9308 KB Output is correct
55 Correct 69 ms 9320 KB Output is correct
56 Correct 67 ms 9192 KB Output is correct
57 Correct 72 ms 9320 KB Output is correct
58 Correct 72 ms 9320 KB Output is correct
59 Correct 74 ms 9320 KB Output is correct
60 Correct 74 ms 9320 KB Output is correct
61 Correct 74 ms 9320 KB Output is correct
62 Correct 84 ms 9320 KB Output is correct
63 Correct 73 ms 9448 KB Output is correct
64 Correct 77 ms 9320 KB Output is correct
65 Correct 78 ms 9320 KB Output is correct
66 Correct 73 ms 9320 KB Output is correct
67 Correct 64 ms 9320 KB Output is correct
68 Correct 65 ms 9320 KB Output is correct
69 Correct 67 ms 9284 KB Output is correct
70 Correct 64 ms 9320 KB Output is correct
71 Correct 144 ms 18120 KB Output is correct
72 Correct 143 ms 18144 KB Output is correct
73 Correct 153 ms 18148 KB Output is correct
74 Correct 151 ms 18144 KB Output is correct
75 Correct 152 ms 18144 KB Output is correct
76 Correct 146 ms 18144 KB Output is correct
77 Correct 146 ms 18104 KB Output is correct
78 Correct 142 ms 18016 KB Output is correct
79 Correct 143 ms 18016 KB Output is correct
80 Correct 144 ms 18224 KB Output is correct
81 Correct 5 ms 376 KB Output is correct
82 Correct 5 ms 504 KB Output is correct
83 Correct 5 ms 504 KB Output is correct
84 Correct 5 ms 504 KB Output is correct
85 Correct 5 ms 504 KB Output is correct
86 Correct 5 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 380 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 6 ms 504 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 5 ms 504 KB Output is correct
15 Correct 5 ms 504 KB Output is correct
16 Correct 5 ms 504 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 6 ms 504 KB Output is correct
19 Correct 5 ms 504 KB Output is correct
20 Correct 5 ms 504 KB Output is correct
21 Correct 5 ms 504 KB Output is correct
22 Correct 7 ms 504 KB Output is correct
23 Correct 63 ms 9448 KB Output is correct
24 Correct 62 ms 9320 KB Output is correct
25 Correct 62 ms 9320 KB Output is correct
26 Correct 61 ms 9320 KB Output is correct
27 Correct 66 ms 9320 KB Output is correct
28 Correct 64 ms 9320 KB Output is correct
29 Correct 64 ms 9324 KB Output is correct
30 Correct 65 ms 9320 KB Output is correct
31 Correct 63 ms 9320 KB Output is correct
32 Correct 74 ms 9320 KB Output is correct
33 Correct 70 ms 9324 KB Output is correct
34 Correct 74 ms 9444 KB Output is correct
35 Correct 74 ms 9324 KB Output is correct
36 Correct 74 ms 9320 KB Output is correct
37 Correct 64 ms 9320 KB Output is correct
38 Correct 68 ms 9320 KB Output is correct
39 Correct 64 ms 9320 KB Output is correct
40 Correct 63 ms 9320 KB Output is correct
41 Correct 65 ms 9320 KB Output is correct
42 Correct 65 ms 9316 KB Output is correct
43 Correct 153 ms 18016 KB Output is correct
44 Correct 151 ms 18144 KB Output is correct
45 Correct 143 ms 18144 KB Output is correct
46 Correct 152 ms 18016 KB Output is correct
47 Correct 155 ms 18148 KB Output is correct
48 Correct 149 ms 18144 KB Output is correct
49 Correct 143 ms 18144 KB Output is correct
50 Correct 144 ms 18012 KB Output is correct
51 Correct 145 ms 18148 KB Output is correct
52 Correct 146 ms 18148 KB Output is correct
53 Correct 65 ms 9320 KB Output is correct
54 Correct 68 ms 9308 KB Output is correct
55 Correct 69 ms 9320 KB Output is correct
56 Correct 67 ms 9192 KB Output is correct
57 Correct 72 ms 9320 KB Output is correct
58 Correct 72 ms 9320 KB Output is correct
59 Correct 74 ms 9320 KB Output is correct
60 Correct 74 ms 9320 KB Output is correct
61 Correct 74 ms 9320 KB Output is correct
62 Correct 84 ms 9320 KB Output is correct
63 Correct 73 ms 9448 KB Output is correct
64 Correct 77 ms 9320 KB Output is correct
65 Correct 78 ms 9320 KB Output is correct
66 Correct 73 ms 9320 KB Output is correct
67 Correct 64 ms 9320 KB Output is correct
68 Correct 65 ms 9320 KB Output is correct
69 Correct 67 ms 9284 KB Output is correct
70 Correct 64 ms 9320 KB Output is correct
71 Correct 144 ms 18120 KB Output is correct
72 Correct 143 ms 18144 KB Output is correct
73 Correct 153 ms 18148 KB Output is correct
74 Correct 151 ms 18144 KB Output is correct
75 Correct 152 ms 18144 KB Output is correct
76 Correct 146 ms 18144 KB Output is correct
77 Correct 146 ms 18104 KB Output is correct
78 Correct 142 ms 18016 KB Output is correct
79 Correct 143 ms 18016 KB Output is correct
80 Correct 144 ms 18224 KB Output is correct
81 Correct 88 ms 9320 KB Output is correct
82 Correct 88 ms 9320 KB Output is correct
83 Correct 95 ms 9320 KB Output is correct
84 Correct 93 ms 9448 KB Output is correct
85 Correct 92 ms 9448 KB Output is correct
86 Correct 91 ms 9320 KB Output is correct
87 Correct 88 ms 9320 KB Output is correct
88 Correct 90 ms 9320 KB Output is correct
89 Correct 89 ms 9320 KB Output is correct
90 Correct 90 ms 9324 KB Output is correct
91 Correct 70 ms 9320 KB Output is correct
92 Correct 71 ms 9320 KB Output is correct
93 Correct 75 ms 11752 KB Output is correct
94 Correct 74 ms 11752 KB Output is correct
95 Correct 76 ms 11624 KB Output is correct
96 Correct 71 ms 11756 KB Output is correct
97 Correct 74 ms 11752 KB Output is correct
98 Correct 72 ms 11624 KB Output is correct
99 Correct 76 ms 11736 KB Output is correct
100 Correct 76 ms 11664 KB Output is correct
101 Correct 5 ms 376 KB Output is correct
102 Correct 5 ms 504 KB Output is correct
103 Correct 5 ms 504 KB Output is correct
104 Correct 5 ms 504 KB Output is correct
105 Correct 5 ms 504 KB Output is correct
106 Correct 5 ms 504 KB Output is correct