#include<bits/stdc++.h>
using namespace std;
int n;
long long R,a,b,c,d,l,r,mid,teng,tmp1,tmp2,opo,bwh,ats;
vector<pair<long long,long long> > v;
long long dist(long long x){
long long ret;
ret = (a+c*x)*(a+c*x) + (b+d*x)*(b+d*x);
return ret;
}
int main(){
ios_base::sync_with_stdio(NULL);
cin.tie(0);cout.tie(0);
cin>>n>>R;
R *= R;
for(int i=1;i<=n;i++){
cin>>a>>b>>c>>d;
c = c-a;
d = d-b;
a -= c;
b -= d;
opo = max(abs(c),abs(d));
l = 1;
r = 1e9/opo;
//cout<<r<<endl;
while(l<=r){
mid = (l+r)/2;
tmp1 = dist(mid);
tmp2 = dist(mid+1);
if(tmp1>tmp2){
teng = mid+1;
l = mid+1;
//cout<<tmp2<<endl;
}
else{
teng = mid;
r = mid-1;
//cout<<tmp1<<endl;
}
}
//cout<<teng<<endl;
if(dist(teng) > R) continue;
l = 1;
r = teng;
bwh = teng;
while(l<=r){
mid = (l+r)/2;
tmp1 = dist(mid);
if(tmp1 <= R){
bwh = mid;
r = mid-1;
}
else{
l = mid+1;
}
}
l = teng;
r = 1e9/opo;
ats = teng;
while(l<=r){
mid = (l+r)/2;
tmp1 = dist(mid);
if(tmp1 <= R){
ats = mid;
l = mid+1;
}
else{
r = mid-1;
}
}
//cout<<bwh<<' '<<ats<<endl;
v.push_back(make_pair(bwh,ats));
}
sort(v.begin(),v.end());
priority_queue<long long> st;
int ans=0,cnt;
for(auto x : v){
//cout<<x.first<<' '<<x.second<<endl;
while(!st.empty()){
if(-st.top() < x.first){
st.pop();
cnt--;
}
else break;
}
st.push(-x.second);
cnt++;
ans = max(ans,cnt);
}
cout<<ans<<endl;
}
Compilation message
noras.cpp: In function 'int main()':
noras.cpp:93:6: warning: 'cnt' may be used uninitialized in this function [-Wmaybe-uninitialized]
cnt++;
~~~^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
512 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 |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
2 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 |
2 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
384 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
512 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 |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
2 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 |
2 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
384 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 |
54 ms |
5228 KB |
Output is correct |
24 |
Correct |
71 ms |
5224 KB |
Output is correct |
25 |
Correct |
54 ms |
5228 KB |
Output is correct |
26 |
Correct |
65 ms |
5228 KB |
Output is correct |
27 |
Correct |
57 ms |
3824 KB |
Output is correct |
28 |
Correct |
56 ms |
4324 KB |
Output is correct |
29 |
Correct |
58 ms |
4328 KB |
Output is correct |
30 |
Correct |
58 ms |
4332 KB |
Output is correct |
31 |
Correct |
55 ms |
4328 KB |
Output is correct |
32 |
Correct |
86 ms |
4076 KB |
Output is correct |
33 |
Correct |
85 ms |
3948 KB |
Output is correct |
34 |
Correct |
85 ms |
3952 KB |
Output is correct |
35 |
Correct |
89 ms |
4068 KB |
Output is correct |
36 |
Correct |
90 ms |
4072 KB |
Output is correct |
37 |
Correct |
59 ms |
3696 KB |
Output is correct |
38 |
Correct |
58 ms |
3696 KB |
Output is correct |
39 |
Correct |
55 ms |
3440 KB |
Output is correct |
40 |
Correct |
59 ms |
3568 KB |
Output is correct |
41 |
Correct |
54 ms |
3440 KB |
Output is correct |
42 |
Correct |
58 ms |
3568 KB |
Output is correct |
43 |
Correct |
183 ms |
11360 KB |
Output is correct |
44 |
Correct |
190 ms |
11360 KB |
Output is correct |
45 |
Correct |
186 ms |
11360 KB |
Output is correct |
46 |
Correct |
188 ms |
11360 KB |
Output is correct |
47 |
Correct |
190 ms |
11376 KB |
Output is correct |
48 |
Correct |
182 ms |
7904 KB |
Output is correct |
49 |
Correct |
179 ms |
7892 KB |
Output is correct |
50 |
Correct |
177 ms |
7780 KB |
Output is correct |
51 |
Correct |
173 ms |
7764 KB |
Output is correct |
52 |
Correct |
175 ms |
7648 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
512 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 |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
2 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 |
2 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
384 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 |
0 ms |
384 KB |
Output is correct |
24 |
Correct |
1 ms |
384 KB |
Output is correct |
25 |
Correct |
2 ms |
512 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
512 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 |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
2 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 |
2 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
384 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 |
54 ms |
5228 KB |
Output is correct |
24 |
Correct |
71 ms |
5224 KB |
Output is correct |
25 |
Correct |
54 ms |
5228 KB |
Output is correct |
26 |
Correct |
65 ms |
5228 KB |
Output is correct |
27 |
Correct |
57 ms |
3824 KB |
Output is correct |
28 |
Correct |
56 ms |
4324 KB |
Output is correct |
29 |
Correct |
58 ms |
4328 KB |
Output is correct |
30 |
Correct |
58 ms |
4332 KB |
Output is correct |
31 |
Correct |
55 ms |
4328 KB |
Output is correct |
32 |
Correct |
86 ms |
4076 KB |
Output is correct |
33 |
Correct |
85 ms |
3948 KB |
Output is correct |
34 |
Correct |
85 ms |
3952 KB |
Output is correct |
35 |
Correct |
89 ms |
4068 KB |
Output is correct |
36 |
Correct |
90 ms |
4072 KB |
Output is correct |
37 |
Correct |
59 ms |
3696 KB |
Output is correct |
38 |
Correct |
58 ms |
3696 KB |
Output is correct |
39 |
Correct |
55 ms |
3440 KB |
Output is correct |
40 |
Correct |
59 ms |
3568 KB |
Output is correct |
41 |
Correct |
54 ms |
3440 KB |
Output is correct |
42 |
Correct |
58 ms |
3568 KB |
Output is correct |
43 |
Correct |
183 ms |
11360 KB |
Output is correct |
44 |
Correct |
190 ms |
11360 KB |
Output is correct |
45 |
Correct |
186 ms |
11360 KB |
Output is correct |
46 |
Correct |
188 ms |
11360 KB |
Output is correct |
47 |
Correct |
190 ms |
11376 KB |
Output is correct |
48 |
Correct |
182 ms |
7904 KB |
Output is correct |
49 |
Correct |
179 ms |
7892 KB |
Output is correct |
50 |
Correct |
177 ms |
7780 KB |
Output is correct |
51 |
Correct |
173 ms |
7764 KB |
Output is correct |
52 |
Correct |
175 ms |
7648 KB |
Output is correct |
53 |
Correct |
70 ms |
5100 KB |
Output is correct |
54 |
Correct |
55 ms |
3308 KB |
Output is correct |
55 |
Correct |
66 ms |
3540 KB |
Output is correct |
56 |
Correct |
57 ms |
3696 KB |
Output is correct |
57 |
Correct |
72 ms |
3312 KB |
Output is correct |
58 |
Correct |
69 ms |
3316 KB |
Output is correct |
59 |
Correct |
69 ms |
3312 KB |
Output is correct |
60 |
Correct |
72 ms |
3432 KB |
Output is correct |
61 |
Correct |
69 ms |
3312 KB |
Output is correct |
62 |
Correct |
92 ms |
4080 KB |
Output is correct |
63 |
Correct |
91 ms |
4032 KB |
Output is correct |
64 |
Correct |
91 ms |
4080 KB |
Output is correct |
65 |
Correct |
91 ms |
4080 KB |
Output is correct |
66 |
Correct |
93 ms |
4076 KB |
Output is correct |
67 |
Correct |
63 ms |
3568 KB |
Output is correct |
68 |
Correct |
63 ms |
4080 KB |
Output is correct |
69 |
Correct |
69 ms |
4208 KB |
Output is correct |
70 |
Correct |
60 ms |
3696 KB |
Output is correct |
71 |
Correct |
183 ms |
10592 KB |
Output is correct |
72 |
Correct |
178 ms |
10608 KB |
Output is correct |
73 |
Correct |
190 ms |
10712 KB |
Output is correct |
74 |
Correct |
178 ms |
10720 KB |
Output is correct |
75 |
Correct |
174 ms |
10596 KB |
Output is correct |
76 |
Correct |
178 ms |
7904 KB |
Output is correct |
77 |
Correct |
182 ms |
7852 KB |
Output is correct |
78 |
Correct |
181 ms |
8036 KB |
Output is correct |
79 |
Correct |
182 ms |
7784 KB |
Output is correct |
80 |
Correct |
182 ms |
8032 KB |
Output is correct |
81 |
Correct |
0 ms |
384 KB |
Output is correct |
82 |
Correct |
1 ms |
384 KB |
Output is correct |
83 |
Correct |
2 ms |
512 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
512 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 |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
2 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 |
2 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
384 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 |
54 ms |
5228 KB |
Output is correct |
24 |
Correct |
71 ms |
5224 KB |
Output is correct |
25 |
Correct |
54 ms |
5228 KB |
Output is correct |
26 |
Correct |
65 ms |
5228 KB |
Output is correct |
27 |
Correct |
57 ms |
3824 KB |
Output is correct |
28 |
Correct |
56 ms |
4324 KB |
Output is correct |
29 |
Correct |
58 ms |
4328 KB |
Output is correct |
30 |
Correct |
58 ms |
4332 KB |
Output is correct |
31 |
Correct |
55 ms |
4328 KB |
Output is correct |
32 |
Correct |
86 ms |
4076 KB |
Output is correct |
33 |
Correct |
85 ms |
3948 KB |
Output is correct |
34 |
Correct |
85 ms |
3952 KB |
Output is correct |
35 |
Correct |
89 ms |
4068 KB |
Output is correct |
36 |
Correct |
90 ms |
4072 KB |
Output is correct |
37 |
Correct |
59 ms |
3696 KB |
Output is correct |
38 |
Correct |
58 ms |
3696 KB |
Output is correct |
39 |
Correct |
55 ms |
3440 KB |
Output is correct |
40 |
Correct |
59 ms |
3568 KB |
Output is correct |
41 |
Correct |
54 ms |
3440 KB |
Output is correct |
42 |
Correct |
58 ms |
3568 KB |
Output is correct |
43 |
Correct |
183 ms |
11360 KB |
Output is correct |
44 |
Correct |
190 ms |
11360 KB |
Output is correct |
45 |
Correct |
186 ms |
11360 KB |
Output is correct |
46 |
Correct |
188 ms |
11360 KB |
Output is correct |
47 |
Correct |
190 ms |
11376 KB |
Output is correct |
48 |
Correct |
182 ms |
7904 KB |
Output is correct |
49 |
Correct |
179 ms |
7892 KB |
Output is correct |
50 |
Correct |
177 ms |
7780 KB |
Output is correct |
51 |
Correct |
173 ms |
7764 KB |
Output is correct |
52 |
Correct |
175 ms |
7648 KB |
Output is correct |
53 |
Correct |
70 ms |
5100 KB |
Output is correct |
54 |
Correct |
55 ms |
3308 KB |
Output is correct |
55 |
Correct |
66 ms |
3540 KB |
Output is correct |
56 |
Correct |
57 ms |
3696 KB |
Output is correct |
57 |
Correct |
72 ms |
3312 KB |
Output is correct |
58 |
Correct |
69 ms |
3316 KB |
Output is correct |
59 |
Correct |
69 ms |
3312 KB |
Output is correct |
60 |
Correct |
72 ms |
3432 KB |
Output is correct |
61 |
Correct |
69 ms |
3312 KB |
Output is correct |
62 |
Correct |
92 ms |
4080 KB |
Output is correct |
63 |
Correct |
91 ms |
4032 KB |
Output is correct |
64 |
Correct |
91 ms |
4080 KB |
Output is correct |
65 |
Correct |
91 ms |
4080 KB |
Output is correct |
66 |
Correct |
93 ms |
4076 KB |
Output is correct |
67 |
Correct |
63 ms |
3568 KB |
Output is correct |
68 |
Correct |
63 ms |
4080 KB |
Output is correct |
69 |
Correct |
69 ms |
4208 KB |
Output is correct |
70 |
Correct |
60 ms |
3696 KB |
Output is correct |
71 |
Correct |
183 ms |
10592 KB |
Output is correct |
72 |
Correct |
178 ms |
10608 KB |
Output is correct |
73 |
Correct |
190 ms |
10712 KB |
Output is correct |
74 |
Correct |
178 ms |
10720 KB |
Output is correct |
75 |
Correct |
174 ms |
10596 KB |
Output is correct |
76 |
Correct |
178 ms |
7904 KB |
Output is correct |
77 |
Correct |
182 ms |
7852 KB |
Output is correct |
78 |
Correct |
181 ms |
8036 KB |
Output is correct |
79 |
Correct |
182 ms |
7784 KB |
Output is correct |
80 |
Correct |
182 ms |
8032 KB |
Output is correct |
81 |
Correct |
97 ms |
4852 KB |
Output is correct |
82 |
Correct |
91 ms |
4976 KB |
Output is correct |
83 |
Correct |
91 ms |
4848 KB |
Output is correct |
84 |
Correct |
90 ms |
4848 KB |
Output is correct |
85 |
Correct |
91 ms |
4972 KB |
Output is correct |
86 |
Correct |
100 ms |
4848 KB |
Output is correct |
87 |
Correct |
99 ms |
4848 KB |
Output is correct |
88 |
Correct |
102 ms |
4956 KB |
Output is correct |
89 |
Correct |
104 ms |
4820 KB |
Output is correct |
90 |
Correct |
105 ms |
4948 KB |
Output is correct |
91 |
Correct |
58 ms |
6056 KB |
Output is correct |
92 |
Correct |
55 ms |
5992 KB |
Output is correct |
93 |
Correct |
57 ms |
5996 KB |
Output is correct |
94 |
Correct |
58 ms |
5964 KB |
Output is correct |
95 |
Correct |
56 ms |
5992 KB |
Output is correct |
96 |
Correct |
71 ms |
5992 KB |
Output is correct |
97 |
Correct |
57 ms |
5996 KB |
Output is correct |
98 |
Correct |
61 ms |
5992 KB |
Output is correct |
99 |
Correct |
59 ms |
5996 KB |
Output is correct |
100 |
Correct |
57 ms |
5996 KB |
Output is correct |
101 |
Correct |
0 ms |
384 KB |
Output is correct |
102 |
Correct |
1 ms |
384 KB |
Output is correct |
103 |
Correct |
2 ms |
512 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 |