Submission #912357

# Submission time Handle Problem Language Result Execution time Memory
912357 2024-01-19T10:17:12 Z vjudge1 Wish (LMIO19_noras) C++17
100 / 100
240 ms 19444 KB
#include <bits/stdc++.h>
#define f first
#define s second	
#define ent '\n'
#define int long long

#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")

using namespace std;
typedef long long ll;
const int mx=1e6+12;
const int mod=1e9+7;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};

map<int,int> pref;
int L[mx];
int R[mx];
int x[mx];
int y[mx];
int a[mx];
int b[mx];
int n,m,k;

bool check(__int128 x,__int128 y){
	if(max(x,y)>k)return 0;
	return x*x+y*y<=k*k;
}

bool check(__int128 x1,__int128 y1,__int128 x2,__int128 y2){
	__int128 val=(__int128)x1*(__int128)x1+(__int128)y1*(__int128)y1;
	__int128 cal=(__int128)x2*(__int128)x2+(__int128)y2*(__int128)y2;
	if(val>=cal)return 1;
	return 0;
}

void Press_Fn_with_F11(){
	cin>>n>>k;
	int ans=0;
	for(int i=1;i<=n;i++){
		cin>>x[i]>>y[i]>>a[i]>>b[i];
		a[i]-=x[i];
		b[i]-=y[i];
		int l=0,r=2e9,pos0=0;
		while(r-l>10){
			int m1=l+(r-l)/3,m2=r-(r-l)/3;
			if(check(x[i]+m1*a[i],y[i]+m1*b[i],x[i]+m2*a[i],y[i]+m2*b[i])){
				l=m1;
			}
			else r=m2;
		}
		pos0=l;
		for(int v=l+1;v<=r;v++){
			if(check(pos0*a[i]+x[i],pos0*b[i]+y[i],v*a[i]+x[i],v*b[i]+y[i])){
				pos0=v;
			}
		}
		if(!check(x[i]+pos0*a[i],y[i]+pos0*b[i])){
			continue;
		}
		int L=pos0,R=pos0;
		for(int l=0,r=pos0;l<=r;){
			int mid=l+r>>1ll;
			if(check((__int128)mid*a[i]+x[i],(__int128)mid*b[i]+y[i])){
				L=mid;
				r=mid-1;
			}
			else l=mid+1;
		}
		for(int l=pos0,r=2e9;l<=r;){
			int mid=l+r>>1ll;
			if(check((__int128)mid*a[i]+x[i],(__int128)mid*b[i]+y[i])){
				R=mid;
				l=mid+1;
			}
			else r=mid-1;
		}
		pref[L]++;
		pref[R+1]--;
	}
	int v=0;
	for(auto x:pref){
		v+=x.s;
		ans=max(ans,v);
	}
	cout<<ans<<ent;
	
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int Alikhan_abi_crush=1;
	// cin>>Alikhan_abi_crush;
	while(Alikhan_abi_crush--){
		Press_Fn_with_F11();
	}
}

Compilation message

noras.cpp: In function 'void Press_Fn_with_F11()':
noras.cpp:64:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   64 |    int mid=l+r>>1ll;
      |            ~^~
noras.cpp:72:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   72 |    int mid=l+r>>1ll;
      |            ~^~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6744 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 2 ms 6492 KB Output is correct
4 Correct 2 ms 6492 KB Output is correct
5 Correct 2 ms 6492 KB Output is correct
6 Correct 2 ms 6492 KB Output is correct
7 Correct 2 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6488 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 1 ms 6492 KB Output is correct
13 Correct 1 ms 6488 KB Output is correct
14 Correct 2 ms 6492 KB Output is correct
15 Correct 2 ms 6488 KB Output is correct
16 Correct 2 ms 6492 KB Output is correct
17 Correct 3 ms 6492 KB Output is correct
18 Correct 2 ms 6492 KB Output is correct
19 Correct 2 ms 6492 KB Output is correct
20 Correct 2 ms 6492 KB Output is correct
21 Correct 2 ms 6492 KB Output is correct
22 Correct 2 ms 6488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6744 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 2 ms 6492 KB Output is correct
4 Correct 2 ms 6492 KB Output is correct
5 Correct 2 ms 6492 KB Output is correct
6 Correct 2 ms 6492 KB Output is correct
7 Correct 2 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6488 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 1 ms 6492 KB Output is correct
13 Correct 1 ms 6488 KB Output is correct
14 Correct 2 ms 6492 KB Output is correct
15 Correct 2 ms 6488 KB Output is correct
16 Correct 2 ms 6492 KB Output is correct
17 Correct 3 ms 6492 KB Output is correct
18 Correct 2 ms 6492 KB Output is correct
19 Correct 2 ms 6492 KB Output is correct
20 Correct 2 ms 6492 KB Output is correct
21 Correct 2 ms 6492 KB Output is correct
22 Correct 2 ms 6488 KB Output is correct
23 Correct 73 ms 10868 KB Output is correct
24 Correct 80 ms 10832 KB Output is correct
25 Correct 76 ms 11088 KB Output is correct
26 Correct 73 ms 10764 KB Output is correct
27 Correct 70 ms 10836 KB Output is correct
28 Correct 74 ms 10632 KB Output is correct
29 Correct 74 ms 10632 KB Output is correct
30 Correct 80 ms 11096 KB Output is correct
31 Correct 79 ms 10836 KB Output is correct
32 Correct 91 ms 10664 KB Output is correct
33 Correct 91 ms 10832 KB Output is correct
34 Correct 91 ms 10752 KB Output is correct
35 Correct 90 ms 10672 KB Output is correct
36 Correct 91 ms 10840 KB Output is correct
37 Correct 73 ms 10628 KB Output is correct
38 Correct 72 ms 10832 KB Output is correct
39 Correct 71 ms 10832 KB Output is correct
40 Correct 71 ms 10832 KB Output is correct
41 Correct 70 ms 10836 KB Output is correct
42 Correct 70 ms 10880 KB Output is correct
43 Correct 239 ms 16164 KB Output is correct
44 Correct 240 ms 16056 KB Output is correct
45 Correct 231 ms 15952 KB Output is correct
46 Correct 237 ms 15952 KB Output is correct
47 Correct 228 ms 16136 KB Output is correct
48 Correct 181 ms 15024 KB Output is correct
49 Correct 183 ms 15012 KB Output is correct
50 Correct 187 ms 15016 KB Output is correct
51 Correct 180 ms 15000 KB Output is correct
52 Correct 186 ms 14932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6744 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 2 ms 6492 KB Output is correct
4 Correct 2 ms 6492 KB Output is correct
5 Correct 2 ms 6492 KB Output is correct
6 Correct 2 ms 6492 KB Output is correct
7 Correct 2 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6488 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 1 ms 6492 KB Output is correct
13 Correct 1 ms 6488 KB Output is correct
14 Correct 2 ms 6492 KB Output is correct
15 Correct 2 ms 6488 KB Output is correct
16 Correct 2 ms 6492 KB Output is correct
17 Correct 3 ms 6492 KB Output is correct
18 Correct 2 ms 6492 KB Output is correct
19 Correct 2 ms 6492 KB Output is correct
20 Correct 2 ms 6492 KB Output is correct
21 Correct 2 ms 6492 KB Output is correct
22 Correct 2 ms 6488 KB Output is correct
23 Correct 2 ms 6492 KB Output is correct
24 Correct 2 ms 6492 KB Output is correct
25 Correct 2 ms 6488 KB Output is correct
26 Correct 3 ms 6492 KB Output is correct
27 Correct 3 ms 6492 KB Output is correct
28 Correct 2 ms 6492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6744 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 2 ms 6492 KB Output is correct
4 Correct 2 ms 6492 KB Output is correct
5 Correct 2 ms 6492 KB Output is correct
6 Correct 2 ms 6492 KB Output is correct
7 Correct 2 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6488 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 1 ms 6492 KB Output is correct
13 Correct 1 ms 6488 KB Output is correct
14 Correct 2 ms 6492 KB Output is correct
15 Correct 2 ms 6488 KB Output is correct
16 Correct 2 ms 6492 KB Output is correct
17 Correct 3 ms 6492 KB Output is correct
18 Correct 2 ms 6492 KB Output is correct
19 Correct 2 ms 6492 KB Output is correct
20 Correct 2 ms 6492 KB Output is correct
21 Correct 2 ms 6492 KB Output is correct
22 Correct 2 ms 6488 KB Output is correct
23 Correct 73 ms 10868 KB Output is correct
24 Correct 80 ms 10832 KB Output is correct
25 Correct 76 ms 11088 KB Output is correct
26 Correct 73 ms 10764 KB Output is correct
27 Correct 70 ms 10836 KB Output is correct
28 Correct 74 ms 10632 KB Output is correct
29 Correct 74 ms 10632 KB Output is correct
30 Correct 80 ms 11096 KB Output is correct
31 Correct 79 ms 10836 KB Output is correct
32 Correct 91 ms 10664 KB Output is correct
33 Correct 91 ms 10832 KB Output is correct
34 Correct 91 ms 10752 KB Output is correct
35 Correct 90 ms 10672 KB Output is correct
36 Correct 91 ms 10840 KB Output is correct
37 Correct 73 ms 10628 KB Output is correct
38 Correct 72 ms 10832 KB Output is correct
39 Correct 71 ms 10832 KB Output is correct
40 Correct 71 ms 10832 KB Output is correct
41 Correct 70 ms 10836 KB Output is correct
42 Correct 70 ms 10880 KB Output is correct
43 Correct 239 ms 16164 KB Output is correct
44 Correct 240 ms 16056 KB Output is correct
45 Correct 231 ms 15952 KB Output is correct
46 Correct 237 ms 15952 KB Output is correct
47 Correct 228 ms 16136 KB Output is correct
48 Correct 181 ms 15024 KB Output is correct
49 Correct 183 ms 15012 KB Output is correct
50 Correct 187 ms 15016 KB Output is correct
51 Correct 180 ms 15000 KB Output is correct
52 Correct 186 ms 14932 KB Output is correct
53 Correct 2 ms 6492 KB Output is correct
54 Correct 2 ms 6492 KB Output is correct
55 Correct 2 ms 6488 KB Output is correct
56 Correct 3 ms 6492 KB Output is correct
57 Correct 3 ms 6492 KB Output is correct
58 Correct 2 ms 6492 KB Output is correct
59 Correct 79 ms 10868 KB Output is correct
60 Correct 77 ms 10836 KB Output is correct
61 Correct 71 ms 10628 KB Output is correct
62 Correct 71 ms 10836 KB Output is correct
63 Correct 84 ms 11204 KB Output is correct
64 Correct 84 ms 11344 KB Output is correct
65 Correct 84 ms 11236 KB Output is correct
66 Correct 99 ms 11316 KB Output is correct
67 Correct 87 ms 11348 KB Output is correct
68 Correct 96 ms 10836 KB Output is correct
69 Correct 112 ms 10940 KB Output is correct
70 Correct 94 ms 10936 KB Output is correct
71 Correct 97 ms 10844 KB Output is correct
72 Correct 102 ms 10940 KB Output is correct
73 Correct 72 ms 10624 KB Output is correct
74 Correct 72 ms 10832 KB Output is correct
75 Correct 75 ms 10624 KB Output is correct
76 Correct 72 ms 10832 KB Output is correct
77 Correct 219 ms 16220 KB Output is correct
78 Correct 215 ms 16160 KB Output is correct
79 Correct 214 ms 16212 KB Output is correct
80 Correct 228 ms 16652 KB Output is correct
81 Correct 222 ms 16376 KB Output is correct
82 Correct 190 ms 14928 KB Output is correct
83 Correct 190 ms 14944 KB Output is correct
84 Correct 188 ms 15060 KB Output is correct
85 Correct 197 ms 14932 KB Output is correct
86 Correct 193 ms 15264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6744 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 2 ms 6492 KB Output is correct
4 Correct 2 ms 6492 KB Output is correct
5 Correct 2 ms 6492 KB Output is correct
6 Correct 2 ms 6492 KB Output is correct
7 Correct 2 ms 6492 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 6488 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 1 ms 6492 KB Output is correct
13 Correct 1 ms 6488 KB Output is correct
14 Correct 2 ms 6492 KB Output is correct
15 Correct 2 ms 6488 KB Output is correct
16 Correct 2 ms 6492 KB Output is correct
17 Correct 3 ms 6492 KB Output is correct
18 Correct 2 ms 6492 KB Output is correct
19 Correct 2 ms 6492 KB Output is correct
20 Correct 2 ms 6492 KB Output is correct
21 Correct 2 ms 6492 KB Output is correct
22 Correct 2 ms 6488 KB Output is correct
23 Correct 73 ms 10868 KB Output is correct
24 Correct 80 ms 10832 KB Output is correct
25 Correct 76 ms 11088 KB Output is correct
26 Correct 73 ms 10764 KB Output is correct
27 Correct 70 ms 10836 KB Output is correct
28 Correct 74 ms 10632 KB Output is correct
29 Correct 74 ms 10632 KB Output is correct
30 Correct 80 ms 11096 KB Output is correct
31 Correct 79 ms 10836 KB Output is correct
32 Correct 91 ms 10664 KB Output is correct
33 Correct 91 ms 10832 KB Output is correct
34 Correct 91 ms 10752 KB Output is correct
35 Correct 90 ms 10672 KB Output is correct
36 Correct 91 ms 10840 KB Output is correct
37 Correct 73 ms 10628 KB Output is correct
38 Correct 72 ms 10832 KB Output is correct
39 Correct 71 ms 10832 KB Output is correct
40 Correct 71 ms 10832 KB Output is correct
41 Correct 70 ms 10836 KB Output is correct
42 Correct 70 ms 10880 KB Output is correct
43 Correct 239 ms 16164 KB Output is correct
44 Correct 240 ms 16056 KB Output is correct
45 Correct 231 ms 15952 KB Output is correct
46 Correct 237 ms 15952 KB Output is correct
47 Correct 228 ms 16136 KB Output is correct
48 Correct 181 ms 15024 KB Output is correct
49 Correct 183 ms 15012 KB Output is correct
50 Correct 187 ms 15016 KB Output is correct
51 Correct 180 ms 15000 KB Output is correct
52 Correct 186 ms 14932 KB Output is correct
53 Correct 79 ms 10868 KB Output is correct
54 Correct 77 ms 10836 KB Output is correct
55 Correct 71 ms 10628 KB Output is correct
56 Correct 71 ms 10836 KB Output is correct
57 Correct 84 ms 11204 KB Output is correct
58 Correct 84 ms 11344 KB Output is correct
59 Correct 84 ms 11236 KB Output is correct
60 Correct 99 ms 11316 KB Output is correct
61 Correct 87 ms 11348 KB Output is correct
62 Correct 96 ms 10836 KB Output is correct
63 Correct 112 ms 10940 KB Output is correct
64 Correct 94 ms 10936 KB Output is correct
65 Correct 97 ms 10844 KB Output is correct
66 Correct 102 ms 10940 KB Output is correct
67 Correct 72 ms 10624 KB Output is correct
68 Correct 72 ms 10832 KB Output is correct
69 Correct 75 ms 10624 KB Output is correct
70 Correct 72 ms 10832 KB Output is correct
71 Correct 219 ms 16220 KB Output is correct
72 Correct 215 ms 16160 KB Output is correct
73 Correct 214 ms 16212 KB Output is correct
74 Correct 228 ms 16652 KB Output is correct
75 Correct 222 ms 16376 KB Output is correct
76 Correct 190 ms 14928 KB Output is correct
77 Correct 190 ms 14944 KB Output is correct
78 Correct 188 ms 15060 KB Output is correct
79 Correct 197 ms 14932 KB Output is correct
80 Correct 193 ms 15264 KB Output is correct
81 Correct 2 ms 6492 KB Output is correct
82 Correct 2 ms 6492 KB Output is correct
83 Correct 2 ms 6488 KB Output is correct
84 Correct 3 ms 6492 KB Output is correct
85 Correct 3 ms 6492 KB Output is correct
86 Correct 2 ms 6492 KB Output is correct
87 Correct 114 ms 15696 KB Output is correct
88 Correct 112 ms 18576 KB Output is correct
89 Correct 112 ms 17588 KB Output is correct
90 Correct 107 ms 16536 KB Output is correct
91 Correct 102 ms 15912 KB Output is correct
92 Correct 117 ms 19268 KB Output is correct
93 Correct 120 ms 19376 KB Output is correct
94 Correct 121 ms 19296 KB Output is correct
95 Correct 118 ms 19444 KB Output is correct
96 Correct 139 ms 19284 KB Output is correct
97 Correct 79 ms 13140 KB Output is correct
98 Correct 81 ms 13032 KB Output is correct
99 Correct 80 ms 13140 KB Output is correct
100 Correct 79 ms 13140 KB Output is correct
101 Correct 80 ms 13140 KB Output is correct
102 Correct 85 ms 13040 KB Output is correct
103 Correct 80 ms 13160 KB Output is correct
104 Correct 79 ms 12992 KB Output is correct
105 Correct 80 ms 13140 KB Output is correct
106 Correct 84 ms 13400 KB Output is correct