# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
199923 |
2020-02-04T05:32:26 Z |
SamAnd |
Wish (LMIO19_noras) |
C++17 |
|
320 ms |
29024 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 double R;
long double 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)
{
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;
if (D < 0)
{
r[i] = -1;
continue;
}
long double ll = (-sqrt(D) - bb) / (2 * aa);
long double rr = (sqrt(D) - bb) / (2 * aa);
if (ll > 0)
{
l[i] = ll;
if (ll != l[i])
++l[i];
}
if (rr >= 0)
{
r[i] = rr;
}
else
{
r[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:75:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < v.size(); ++i)
~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
504 KB |
Output is correct |
4 |
Correct |
6 ms |
504 KB |
Output is correct |
5 |
Correct |
7 ms |
528 KB |
Output is correct |
6 |
Correct |
6 ms |
504 KB |
Output is correct |
7 |
Correct |
6 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 |
504 KB |
Output is correct |
12 |
Correct |
5 ms |
376 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
6 ms |
504 KB |
Output is correct |
15 |
Correct |
7 ms |
504 KB |
Output is correct |
16 |
Correct |
6 ms |
504 KB |
Output is correct |
17 |
Correct |
6 ms |
504 KB |
Output is correct |
18 |
Correct |
6 ms |
632 KB |
Output is correct |
19 |
Correct |
6 ms |
504 KB |
Output is correct |
20 |
Correct |
6 ms |
504 KB |
Output is correct |
21 |
Correct |
6 ms |
504 KB |
Output is correct |
22 |
Correct |
7 ms |
508 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
504 KB |
Output is correct |
4 |
Correct |
6 ms |
504 KB |
Output is correct |
5 |
Correct |
7 ms |
528 KB |
Output is correct |
6 |
Correct |
6 ms |
504 KB |
Output is correct |
7 |
Correct |
6 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 |
504 KB |
Output is correct |
12 |
Correct |
5 ms |
376 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
6 ms |
504 KB |
Output is correct |
15 |
Correct |
7 ms |
504 KB |
Output is correct |
16 |
Correct |
6 ms |
504 KB |
Output is correct |
17 |
Correct |
6 ms |
504 KB |
Output is correct |
18 |
Correct |
6 ms |
632 KB |
Output is correct |
19 |
Correct |
6 ms |
504 KB |
Output is correct |
20 |
Correct |
6 ms |
504 KB |
Output is correct |
21 |
Correct |
6 ms |
504 KB |
Output is correct |
22 |
Correct |
7 ms |
508 KB |
Output is correct |
23 |
Correct |
145 ms |
14032 KB |
Output is correct |
24 |
Correct |
130 ms |
14056 KB |
Output is correct |
25 |
Correct |
139 ms |
14060 KB |
Output is correct |
26 |
Correct |
128 ms |
14212 KB |
Output is correct |
27 |
Correct |
141 ms |
14440 KB |
Output is correct |
28 |
Correct |
140 ms |
14140 KB |
Output is correct |
29 |
Correct |
142 ms |
14188 KB |
Output is correct |
30 |
Correct |
140 ms |
14164 KB |
Output is correct |
31 |
Correct |
142 ms |
14184 KB |
Output is correct |
32 |
Correct |
154 ms |
14184 KB |
Output is correct |
33 |
Correct |
155 ms |
14184 KB |
Output is correct |
34 |
Correct |
154 ms |
14184 KB |
Output is correct |
35 |
Correct |
150 ms |
14180 KB |
Output is correct |
36 |
Correct |
149 ms |
14260 KB |
Output is correct |
37 |
Correct |
136 ms |
14056 KB |
Output is correct |
38 |
Correct |
136 ms |
14060 KB |
Output is correct |
39 |
Correct |
130 ms |
14060 KB |
Output is correct |
40 |
Correct |
146 ms |
14060 KB |
Output is correct |
41 |
Correct |
137 ms |
13928 KB |
Output is correct |
42 |
Correct |
144 ms |
14184 KB |
Output is correct |
43 |
Correct |
314 ms |
28640 KB |
Output is correct |
44 |
Correct |
312 ms |
28640 KB |
Output is correct |
45 |
Correct |
307 ms |
29024 KB |
Output is correct |
46 |
Correct |
301 ms |
28636 KB |
Output is correct |
47 |
Correct |
317 ms |
28744 KB |
Output is correct |
48 |
Correct |
289 ms |
27872 KB |
Output is correct |
49 |
Correct |
283 ms |
27872 KB |
Output is correct |
50 |
Correct |
305 ms |
27876 KB |
Output is correct |
51 |
Correct |
300 ms |
27876 KB |
Output is correct |
52 |
Correct |
306 ms |
27888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
504 KB |
Output is correct |
4 |
Correct |
6 ms |
504 KB |
Output is correct |
5 |
Correct |
7 ms |
528 KB |
Output is correct |
6 |
Correct |
6 ms |
504 KB |
Output is correct |
7 |
Correct |
6 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 |
504 KB |
Output is correct |
12 |
Correct |
5 ms |
376 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
6 ms |
504 KB |
Output is correct |
15 |
Correct |
7 ms |
504 KB |
Output is correct |
16 |
Correct |
6 ms |
504 KB |
Output is correct |
17 |
Correct |
6 ms |
504 KB |
Output is correct |
18 |
Correct |
6 ms |
632 KB |
Output is correct |
19 |
Correct |
6 ms |
504 KB |
Output is correct |
20 |
Correct |
6 ms |
504 KB |
Output is correct |
21 |
Correct |
6 ms |
504 KB |
Output is correct |
22 |
Correct |
7 ms |
508 KB |
Output is correct |
23 |
Correct |
5 ms |
376 KB |
Output is correct |
24 |
Correct |
6 ms |
504 KB |
Output is correct |
25 |
Correct |
6 ms |
504 KB |
Output is correct |
26 |
Correct |
6 ms |
504 KB |
Output is correct |
27 |
Correct |
6 ms |
504 KB |
Output is correct |
28 |
Correct |
7 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
504 KB |
Output is correct |
4 |
Correct |
6 ms |
504 KB |
Output is correct |
5 |
Correct |
7 ms |
528 KB |
Output is correct |
6 |
Correct |
6 ms |
504 KB |
Output is correct |
7 |
Correct |
6 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 |
504 KB |
Output is correct |
12 |
Correct |
5 ms |
376 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
6 ms |
504 KB |
Output is correct |
15 |
Correct |
7 ms |
504 KB |
Output is correct |
16 |
Correct |
6 ms |
504 KB |
Output is correct |
17 |
Correct |
6 ms |
504 KB |
Output is correct |
18 |
Correct |
6 ms |
632 KB |
Output is correct |
19 |
Correct |
6 ms |
504 KB |
Output is correct |
20 |
Correct |
6 ms |
504 KB |
Output is correct |
21 |
Correct |
6 ms |
504 KB |
Output is correct |
22 |
Correct |
7 ms |
508 KB |
Output is correct |
23 |
Correct |
145 ms |
14032 KB |
Output is correct |
24 |
Correct |
130 ms |
14056 KB |
Output is correct |
25 |
Correct |
139 ms |
14060 KB |
Output is correct |
26 |
Correct |
128 ms |
14212 KB |
Output is correct |
27 |
Correct |
141 ms |
14440 KB |
Output is correct |
28 |
Correct |
140 ms |
14140 KB |
Output is correct |
29 |
Correct |
142 ms |
14188 KB |
Output is correct |
30 |
Correct |
140 ms |
14164 KB |
Output is correct |
31 |
Correct |
142 ms |
14184 KB |
Output is correct |
32 |
Correct |
154 ms |
14184 KB |
Output is correct |
33 |
Correct |
155 ms |
14184 KB |
Output is correct |
34 |
Correct |
154 ms |
14184 KB |
Output is correct |
35 |
Correct |
150 ms |
14180 KB |
Output is correct |
36 |
Correct |
149 ms |
14260 KB |
Output is correct |
37 |
Correct |
136 ms |
14056 KB |
Output is correct |
38 |
Correct |
136 ms |
14060 KB |
Output is correct |
39 |
Correct |
130 ms |
14060 KB |
Output is correct |
40 |
Correct |
146 ms |
14060 KB |
Output is correct |
41 |
Correct |
137 ms |
13928 KB |
Output is correct |
42 |
Correct |
144 ms |
14184 KB |
Output is correct |
43 |
Correct |
314 ms |
28640 KB |
Output is correct |
44 |
Correct |
312 ms |
28640 KB |
Output is correct |
45 |
Correct |
307 ms |
29024 KB |
Output is correct |
46 |
Correct |
301 ms |
28636 KB |
Output is correct |
47 |
Correct |
317 ms |
28744 KB |
Output is correct |
48 |
Correct |
289 ms |
27872 KB |
Output is correct |
49 |
Correct |
283 ms |
27872 KB |
Output is correct |
50 |
Correct |
305 ms |
27876 KB |
Output is correct |
51 |
Correct |
300 ms |
27876 KB |
Output is correct |
52 |
Correct |
306 ms |
27888 KB |
Output is correct |
53 |
Correct |
126 ms |
14056 KB |
Output is correct |
54 |
Correct |
142 ms |
14576 KB |
Output is correct |
55 |
Correct |
145 ms |
14440 KB |
Output is correct |
56 |
Correct |
152 ms |
14440 KB |
Output is correct |
57 |
Correct |
154 ms |
14440 KB |
Output is correct |
58 |
Correct |
147 ms |
14436 KB |
Output is correct |
59 |
Correct |
150 ms |
14692 KB |
Output is correct |
60 |
Correct |
148 ms |
14568 KB |
Output is correct |
61 |
Correct |
148 ms |
14568 KB |
Output is correct |
62 |
Correct |
150 ms |
14316 KB |
Output is correct |
63 |
Correct |
149 ms |
14316 KB |
Output is correct |
64 |
Correct |
151 ms |
14312 KB |
Output is correct |
65 |
Correct |
155 ms |
14308 KB |
Output is correct |
66 |
Correct |
162 ms |
14336 KB |
Output is correct |
67 |
Correct |
135 ms |
13928 KB |
Output is correct |
68 |
Correct |
138 ms |
14056 KB |
Output is correct |
69 |
Correct |
133 ms |
14056 KB |
Output is correct |
70 |
Correct |
140 ms |
14184 KB |
Output is correct |
71 |
Correct |
296 ms |
28640 KB |
Output is correct |
72 |
Correct |
301 ms |
28640 KB |
Output is correct |
73 |
Correct |
304 ms |
28640 KB |
Output is correct |
74 |
Correct |
314 ms |
28640 KB |
Output is correct |
75 |
Correct |
311 ms |
28640 KB |
Output is correct |
76 |
Correct |
309 ms |
28128 KB |
Output is correct |
77 |
Correct |
311 ms |
28128 KB |
Output is correct |
78 |
Correct |
301 ms |
28128 KB |
Output is correct |
79 |
Correct |
309 ms |
28128 KB |
Output is correct |
80 |
Correct |
320 ms |
28172 KB |
Output is correct |
81 |
Correct |
5 ms |
376 KB |
Output is correct |
82 |
Correct |
6 ms |
504 KB |
Output is correct |
83 |
Correct |
6 ms |
504 KB |
Output is correct |
84 |
Correct |
6 ms |
504 KB |
Output is correct |
85 |
Correct |
6 ms |
504 KB |
Output is correct |
86 |
Correct |
7 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
504 KB |
Output is correct |
4 |
Correct |
6 ms |
504 KB |
Output is correct |
5 |
Correct |
7 ms |
528 KB |
Output is correct |
6 |
Correct |
6 ms |
504 KB |
Output is correct |
7 |
Correct |
6 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 |
504 KB |
Output is correct |
12 |
Correct |
5 ms |
376 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
6 ms |
504 KB |
Output is correct |
15 |
Correct |
7 ms |
504 KB |
Output is correct |
16 |
Correct |
6 ms |
504 KB |
Output is correct |
17 |
Correct |
6 ms |
504 KB |
Output is correct |
18 |
Correct |
6 ms |
632 KB |
Output is correct |
19 |
Correct |
6 ms |
504 KB |
Output is correct |
20 |
Correct |
6 ms |
504 KB |
Output is correct |
21 |
Correct |
6 ms |
504 KB |
Output is correct |
22 |
Correct |
7 ms |
508 KB |
Output is correct |
23 |
Correct |
145 ms |
14032 KB |
Output is correct |
24 |
Correct |
130 ms |
14056 KB |
Output is correct |
25 |
Correct |
139 ms |
14060 KB |
Output is correct |
26 |
Correct |
128 ms |
14212 KB |
Output is correct |
27 |
Correct |
141 ms |
14440 KB |
Output is correct |
28 |
Correct |
140 ms |
14140 KB |
Output is correct |
29 |
Correct |
142 ms |
14188 KB |
Output is correct |
30 |
Correct |
140 ms |
14164 KB |
Output is correct |
31 |
Correct |
142 ms |
14184 KB |
Output is correct |
32 |
Correct |
154 ms |
14184 KB |
Output is correct |
33 |
Correct |
155 ms |
14184 KB |
Output is correct |
34 |
Correct |
154 ms |
14184 KB |
Output is correct |
35 |
Correct |
150 ms |
14180 KB |
Output is correct |
36 |
Correct |
149 ms |
14260 KB |
Output is correct |
37 |
Correct |
136 ms |
14056 KB |
Output is correct |
38 |
Correct |
136 ms |
14060 KB |
Output is correct |
39 |
Correct |
130 ms |
14060 KB |
Output is correct |
40 |
Correct |
146 ms |
14060 KB |
Output is correct |
41 |
Correct |
137 ms |
13928 KB |
Output is correct |
42 |
Correct |
144 ms |
14184 KB |
Output is correct |
43 |
Correct |
314 ms |
28640 KB |
Output is correct |
44 |
Correct |
312 ms |
28640 KB |
Output is correct |
45 |
Correct |
307 ms |
29024 KB |
Output is correct |
46 |
Correct |
301 ms |
28636 KB |
Output is correct |
47 |
Correct |
317 ms |
28744 KB |
Output is correct |
48 |
Correct |
289 ms |
27872 KB |
Output is correct |
49 |
Correct |
283 ms |
27872 KB |
Output is correct |
50 |
Correct |
305 ms |
27876 KB |
Output is correct |
51 |
Correct |
300 ms |
27876 KB |
Output is correct |
52 |
Correct |
306 ms |
27888 KB |
Output is correct |
53 |
Correct |
126 ms |
14056 KB |
Output is correct |
54 |
Correct |
142 ms |
14576 KB |
Output is correct |
55 |
Correct |
145 ms |
14440 KB |
Output is correct |
56 |
Correct |
152 ms |
14440 KB |
Output is correct |
57 |
Correct |
154 ms |
14440 KB |
Output is correct |
58 |
Correct |
147 ms |
14436 KB |
Output is correct |
59 |
Correct |
150 ms |
14692 KB |
Output is correct |
60 |
Correct |
148 ms |
14568 KB |
Output is correct |
61 |
Correct |
148 ms |
14568 KB |
Output is correct |
62 |
Correct |
150 ms |
14316 KB |
Output is correct |
63 |
Correct |
149 ms |
14316 KB |
Output is correct |
64 |
Correct |
151 ms |
14312 KB |
Output is correct |
65 |
Correct |
155 ms |
14308 KB |
Output is correct |
66 |
Correct |
162 ms |
14336 KB |
Output is correct |
67 |
Correct |
135 ms |
13928 KB |
Output is correct |
68 |
Correct |
138 ms |
14056 KB |
Output is correct |
69 |
Correct |
133 ms |
14056 KB |
Output is correct |
70 |
Correct |
140 ms |
14184 KB |
Output is correct |
71 |
Correct |
296 ms |
28640 KB |
Output is correct |
72 |
Correct |
301 ms |
28640 KB |
Output is correct |
73 |
Correct |
304 ms |
28640 KB |
Output is correct |
74 |
Correct |
314 ms |
28640 KB |
Output is correct |
75 |
Correct |
311 ms |
28640 KB |
Output is correct |
76 |
Correct |
309 ms |
28128 KB |
Output is correct |
77 |
Correct |
311 ms |
28128 KB |
Output is correct |
78 |
Correct |
301 ms |
28128 KB |
Output is correct |
79 |
Correct |
309 ms |
28128 KB |
Output is correct |
80 |
Correct |
320 ms |
28172 KB |
Output is correct |
81 |
Correct |
197 ms |
15976 KB |
Output is correct |
82 |
Correct |
179 ms |
16104 KB |
Output is correct |
83 |
Correct |
176 ms |
15976 KB |
Output is correct |
84 |
Correct |
194 ms |
16080 KB |
Output is correct |
85 |
Correct |
182 ms |
16108 KB |
Output is correct |
86 |
Correct |
176 ms |
15976 KB |
Output is correct |
87 |
Correct |
180 ms |
16148 KB |
Output is correct |
88 |
Correct |
179 ms |
16104 KB |
Output is correct |
89 |
Correct |
177 ms |
15976 KB |
Output is correct |
90 |
Correct |
179 ms |
15976 KB |
Output is correct |
91 |
Correct |
150 ms |
14908 KB |
Output is correct |
92 |
Incorrect |
146 ms |
14824 KB |
Output isn't correct |
93 |
Halted |
0 ms |
0 KB |
- |