# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
253181 |
2020-07-27T11:06:34 Z |
Berted |
Wish (LMIO19_noras) |
C++14 |
|
166 ms |
5344 KB |
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#define ll long long
#define EL __int128_t
#define pii pair<ll, ll>
#define fst first
#define snd second
using namespace std;
const ll INF = 2e18;
inline ll fsqrt(EL val)
{
ll L = 1, R = INF;
while (L < R)
{
ll M = L + R >> 1;
EL t = M; t = t * t;
if (t <= val) {L = M + 1;}
else {R = M;}
}
return L - 1;
}
ll flr(ll a, ll b)
{
if (a < 0) return (a - b + 1) / b;
else return a / b;
}
ll cil(ll a, ll b)
{
if (a < 0) return a / b;
else return (a + b - 1) / b;
}
inline string dts(EL x)
{
string lol = ""; bool f = 0;
if (x < 0) {f = 1; x = -x;}
while (x)
{
lol = (char)(x % 10 + '0') + lol;
x /= 10;
}
if (lol.size() == 0) lol.push_back('0');
else if (f) lol = '-' + lol;
return lol;
}
vector<pii> ivl;
priority_queue<int, vector<int>, greater<int>> pq;
int main()
{
ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n; ll r;
cin >> n >> r;
for (int i = 0; i < n; i++)
{
ll x0, y0, vx, vy;
cin >> x0 >> y0 >> vx >> vy;
vx -= x0; vy -= y0;
EL a = vx * vx + vy * vy, b = 2 * (vx * x0 + vy * y0), c = x0 * x0 + y0 * y0 - r * r;
EL D = b * b - 4 * a * c;
// cout << dts(a) << " " << dts(b) << " " << dts(c) << " " << dts(D) << "\n";
ll L = 1, R = 0;
if (D == 0) {L = cil(-b, 2 * a); R = flr(-b, 2 * a);}
else if (D > 0)
{
ll res = fsqrt(D);
L = cil(-b - res, 2 * a); R = flr(-b + res, 2 * a);
}
L = max(0LL, L);
if (L <= R) {ivl.push_back({L, R});}
}
sort(ivl.begin(), ivl.end());
int res = 0;
for (int i = 0; i < ivl.size(); i++)
{
while (pq.size() && pq.top() < ivl[i].fst) {pq.pop();}
pq.push(ivl[i].snd);
res = max(res, (int)pq.size());
}
cout << res << "\n";
return 0;
}
Compilation message
noras.cpp: In function 'long long int fsqrt(__int128)':
noras.cpp:19:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
ll M = L + R >> 1;
~~^~~
noras.cpp: In function 'int main()':
noras.cpp:82:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < ivl.size(); i++)
~~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
0 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
0 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
0 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
1 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
256 KB |
Output is correct |
20 |
Correct |
1 ms |
384 KB |
Output is correct |
21 |
Correct |
1 ms |
384 KB |
Output is correct |
22 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
0 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
0 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
0 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
1 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
256 KB |
Output is correct |
20 |
Correct |
1 ms |
384 KB |
Output is correct |
21 |
Correct |
1 ms |
384 KB |
Output is correct |
22 |
Correct |
1 ms |
384 KB |
Output is correct |
23 |
Correct |
43 ms |
2796 KB |
Output is correct |
24 |
Correct |
44 ms |
2744 KB |
Output is correct |
25 |
Correct |
45 ms |
2796 KB |
Output is correct |
26 |
Correct |
44 ms |
2804 KB |
Output is correct |
27 |
Correct |
46 ms |
1524 KB |
Output is correct |
28 |
Correct |
47 ms |
2544 KB |
Output is correct |
29 |
Correct |
49 ms |
2544 KB |
Output is correct |
30 |
Correct |
55 ms |
2540 KB |
Output is correct |
31 |
Correct |
49 ms |
2552 KB |
Output is correct |
32 |
Correct |
72 ms |
2544 KB |
Output is correct |
33 |
Correct |
71 ms |
2544 KB |
Output is correct |
34 |
Correct |
73 ms |
2544 KB |
Output is correct |
35 |
Correct |
70 ms |
2544 KB |
Output is correct |
36 |
Correct |
72 ms |
2544 KB |
Output is correct |
37 |
Correct |
49 ms |
1776 KB |
Output is correct |
38 |
Correct |
49 ms |
1776 KB |
Output is correct |
39 |
Correct |
45 ms |
1524 KB |
Output is correct |
40 |
Correct |
44 ms |
1648 KB |
Output is correct |
41 |
Correct |
45 ms |
1524 KB |
Output is correct |
42 |
Correct |
45 ms |
1532 KB |
Output is correct |
43 |
Correct |
148 ms |
5216 KB |
Output is correct |
44 |
Correct |
139 ms |
5220 KB |
Output is correct |
45 |
Correct |
138 ms |
5344 KB |
Output is correct |
46 |
Correct |
140 ms |
5344 KB |
Output is correct |
47 |
Correct |
141 ms |
5216 KB |
Output is correct |
48 |
Correct |
140 ms |
4520 KB |
Output is correct |
49 |
Correct |
145 ms |
4584 KB |
Output is correct |
50 |
Correct |
143 ms |
4588 KB |
Output is correct |
51 |
Correct |
139 ms |
4584 KB |
Output is correct |
52 |
Correct |
143 ms |
4584 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
0 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
0 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
0 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
1 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
256 KB |
Output is correct |
20 |
Correct |
1 ms |
384 KB |
Output is correct |
21 |
Correct |
1 ms |
384 KB |
Output is correct |
22 |
Correct |
1 ms |
384 KB |
Output is correct |
23 |
Correct |
1 ms |
384 KB |
Output is correct |
24 |
Correct |
1 ms |
384 KB |
Output is correct |
25 |
Correct |
1 ms |
384 KB |
Output is correct |
26 |
Correct |
1 ms |
384 KB |
Output is correct |
27 |
Correct |
1 ms |
384 KB |
Output is correct |
28 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
0 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
0 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
0 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
1 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
256 KB |
Output is correct |
20 |
Correct |
1 ms |
384 KB |
Output is correct |
21 |
Correct |
1 ms |
384 KB |
Output is correct |
22 |
Correct |
1 ms |
384 KB |
Output is correct |
23 |
Correct |
43 ms |
2796 KB |
Output is correct |
24 |
Correct |
44 ms |
2744 KB |
Output is correct |
25 |
Correct |
45 ms |
2796 KB |
Output is correct |
26 |
Correct |
44 ms |
2804 KB |
Output is correct |
27 |
Correct |
46 ms |
1524 KB |
Output is correct |
28 |
Correct |
47 ms |
2544 KB |
Output is correct |
29 |
Correct |
49 ms |
2544 KB |
Output is correct |
30 |
Correct |
55 ms |
2540 KB |
Output is correct |
31 |
Correct |
49 ms |
2552 KB |
Output is correct |
32 |
Correct |
72 ms |
2544 KB |
Output is correct |
33 |
Correct |
71 ms |
2544 KB |
Output is correct |
34 |
Correct |
73 ms |
2544 KB |
Output is correct |
35 |
Correct |
70 ms |
2544 KB |
Output is correct |
36 |
Correct |
72 ms |
2544 KB |
Output is correct |
37 |
Correct |
49 ms |
1776 KB |
Output is correct |
38 |
Correct |
49 ms |
1776 KB |
Output is correct |
39 |
Correct |
45 ms |
1524 KB |
Output is correct |
40 |
Correct |
44 ms |
1648 KB |
Output is correct |
41 |
Correct |
45 ms |
1524 KB |
Output is correct |
42 |
Correct |
45 ms |
1532 KB |
Output is correct |
43 |
Correct |
148 ms |
5216 KB |
Output is correct |
44 |
Correct |
139 ms |
5220 KB |
Output is correct |
45 |
Correct |
138 ms |
5344 KB |
Output is correct |
46 |
Correct |
140 ms |
5344 KB |
Output is correct |
47 |
Correct |
141 ms |
5216 KB |
Output is correct |
48 |
Correct |
140 ms |
4520 KB |
Output is correct |
49 |
Correct |
145 ms |
4584 KB |
Output is correct |
50 |
Correct |
143 ms |
4588 KB |
Output is correct |
51 |
Correct |
139 ms |
4584 KB |
Output is correct |
52 |
Correct |
143 ms |
4584 KB |
Output is correct |
53 |
Correct |
47 ms |
2836 KB |
Output is correct |
54 |
Correct |
60 ms |
1524 KB |
Output is correct |
55 |
Correct |
62 ms |
1652 KB |
Output is correct |
56 |
Correct |
60 ms |
1524 KB |
Output is correct |
57 |
Correct |
66 ms |
1524 KB |
Output is correct |
58 |
Correct |
60 ms |
1524 KB |
Output is correct |
59 |
Correct |
65 ms |
1524 KB |
Output is correct |
60 |
Correct |
71 ms |
1524 KB |
Output is correct |
61 |
Correct |
66 ms |
1524 KB |
Output is correct |
62 |
Correct |
77 ms |
2544 KB |
Output is correct |
63 |
Correct |
78 ms |
2540 KB |
Output is correct |
64 |
Correct |
75 ms |
2540 KB |
Output is correct |
65 |
Correct |
80 ms |
2552 KB |
Output is correct |
66 |
Correct |
74 ms |
2544 KB |
Output is correct |
67 |
Correct |
46 ms |
1648 KB |
Output is correct |
68 |
Correct |
51 ms |
2508 KB |
Output is correct |
69 |
Correct |
57 ms |
2492 KB |
Output is correct |
70 |
Correct |
54 ms |
1616 KB |
Output is correct |
71 |
Correct |
158 ms |
4832 KB |
Output is correct |
72 |
Correct |
163 ms |
4748 KB |
Output is correct |
73 |
Correct |
138 ms |
4836 KB |
Output is correct |
74 |
Correct |
136 ms |
4788 KB |
Output is correct |
75 |
Correct |
137 ms |
4704 KB |
Output is correct |
76 |
Correct |
152 ms |
4580 KB |
Output is correct |
77 |
Correct |
166 ms |
4556 KB |
Output is correct |
78 |
Correct |
152 ms |
4584 KB |
Output is correct |
79 |
Correct |
163 ms |
4760 KB |
Output is correct |
80 |
Correct |
160 ms |
4584 KB |
Output is correct |
81 |
Correct |
1 ms |
384 KB |
Output is correct |
82 |
Correct |
1 ms |
384 KB |
Output is correct |
83 |
Correct |
1 ms |
384 KB |
Output is correct |
84 |
Correct |
1 ms |
384 KB |
Output is correct |
85 |
Correct |
1 ms |
384 KB |
Output is correct |
86 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
0 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
0 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
0 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
1 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
256 KB |
Output is correct |
20 |
Correct |
1 ms |
384 KB |
Output is correct |
21 |
Correct |
1 ms |
384 KB |
Output is correct |
22 |
Correct |
1 ms |
384 KB |
Output is correct |
23 |
Correct |
43 ms |
2796 KB |
Output is correct |
24 |
Correct |
44 ms |
2744 KB |
Output is correct |
25 |
Correct |
45 ms |
2796 KB |
Output is correct |
26 |
Correct |
44 ms |
2804 KB |
Output is correct |
27 |
Correct |
46 ms |
1524 KB |
Output is correct |
28 |
Correct |
47 ms |
2544 KB |
Output is correct |
29 |
Correct |
49 ms |
2544 KB |
Output is correct |
30 |
Correct |
55 ms |
2540 KB |
Output is correct |
31 |
Correct |
49 ms |
2552 KB |
Output is correct |
32 |
Correct |
72 ms |
2544 KB |
Output is correct |
33 |
Correct |
71 ms |
2544 KB |
Output is correct |
34 |
Correct |
73 ms |
2544 KB |
Output is correct |
35 |
Correct |
70 ms |
2544 KB |
Output is correct |
36 |
Correct |
72 ms |
2544 KB |
Output is correct |
37 |
Correct |
49 ms |
1776 KB |
Output is correct |
38 |
Correct |
49 ms |
1776 KB |
Output is correct |
39 |
Correct |
45 ms |
1524 KB |
Output is correct |
40 |
Correct |
44 ms |
1648 KB |
Output is correct |
41 |
Correct |
45 ms |
1524 KB |
Output is correct |
42 |
Correct |
45 ms |
1532 KB |
Output is correct |
43 |
Correct |
148 ms |
5216 KB |
Output is correct |
44 |
Correct |
139 ms |
5220 KB |
Output is correct |
45 |
Correct |
138 ms |
5344 KB |
Output is correct |
46 |
Correct |
140 ms |
5344 KB |
Output is correct |
47 |
Correct |
141 ms |
5216 KB |
Output is correct |
48 |
Correct |
140 ms |
4520 KB |
Output is correct |
49 |
Correct |
145 ms |
4584 KB |
Output is correct |
50 |
Correct |
143 ms |
4588 KB |
Output is correct |
51 |
Correct |
139 ms |
4584 KB |
Output is correct |
52 |
Correct |
143 ms |
4584 KB |
Output is correct |
53 |
Correct |
47 ms |
2836 KB |
Output is correct |
54 |
Correct |
60 ms |
1524 KB |
Output is correct |
55 |
Correct |
62 ms |
1652 KB |
Output is correct |
56 |
Correct |
60 ms |
1524 KB |
Output is correct |
57 |
Correct |
66 ms |
1524 KB |
Output is correct |
58 |
Correct |
60 ms |
1524 KB |
Output is correct |
59 |
Correct |
65 ms |
1524 KB |
Output is correct |
60 |
Correct |
71 ms |
1524 KB |
Output is correct |
61 |
Correct |
66 ms |
1524 KB |
Output is correct |
62 |
Correct |
77 ms |
2544 KB |
Output is correct |
63 |
Correct |
78 ms |
2540 KB |
Output is correct |
64 |
Correct |
75 ms |
2540 KB |
Output is correct |
65 |
Correct |
80 ms |
2552 KB |
Output is correct |
66 |
Correct |
74 ms |
2544 KB |
Output is correct |
67 |
Correct |
46 ms |
1648 KB |
Output is correct |
68 |
Correct |
51 ms |
2508 KB |
Output is correct |
69 |
Correct |
57 ms |
2492 KB |
Output is correct |
70 |
Correct |
54 ms |
1616 KB |
Output is correct |
71 |
Correct |
158 ms |
4832 KB |
Output is correct |
72 |
Correct |
163 ms |
4748 KB |
Output is correct |
73 |
Correct |
138 ms |
4836 KB |
Output is correct |
74 |
Correct |
136 ms |
4788 KB |
Output is correct |
75 |
Correct |
137 ms |
4704 KB |
Output is correct |
76 |
Correct |
152 ms |
4580 KB |
Output is correct |
77 |
Correct |
166 ms |
4556 KB |
Output is correct |
78 |
Correct |
152 ms |
4584 KB |
Output is correct |
79 |
Correct |
163 ms |
4760 KB |
Output is correct |
80 |
Correct |
160 ms |
4584 KB |
Output is correct |
81 |
Correct |
91 ms |
1524 KB |
Output is correct |
82 |
Correct |
96 ms |
1524 KB |
Output is correct |
83 |
Correct |
94 ms |
1500 KB |
Output is correct |
84 |
Correct |
90 ms |
1524 KB |
Output is correct |
85 |
Correct |
92 ms |
1524 KB |
Output is correct |
86 |
Correct |
92 ms |
1528 KB |
Output is correct |
87 |
Correct |
89 ms |
1528 KB |
Output is correct |
88 |
Correct |
114 ms |
1520 KB |
Output is correct |
89 |
Correct |
85 ms |
1552 KB |
Output is correct |
90 |
Correct |
86 ms |
1516 KB |
Output is correct |
91 |
Correct |
52 ms |
2668 KB |
Output is correct |
92 |
Correct |
52 ms |
2796 KB |
Output is correct |
93 |
Correct |
55 ms |
2796 KB |
Output is correct |
94 |
Correct |
60 ms |
2668 KB |
Output is correct |
95 |
Correct |
54 ms |
2796 KB |
Output is correct |
96 |
Correct |
51 ms |
2792 KB |
Output is correct |
97 |
Correct |
63 ms |
2792 KB |
Output is correct |
98 |
Correct |
56 ms |
2664 KB |
Output is correct |
99 |
Correct |
56 ms |
2792 KB |
Output is correct |
100 |
Correct |
51 ms |
2664 KB |
Output is correct |
101 |
Correct |
1 ms |
384 KB |
Output is correct |
102 |
Correct |
1 ms |
384 KB |
Output is correct |
103 |
Correct |
1 ms |
384 KB |
Output is correct |
104 |
Correct |
1 ms |
384 KB |
Output is correct |
105 |
Correct |
1 ms |
384 KB |
Output is correct |
106 |
Correct |
1 ms |
384 KB |
Output is correct |