Submission #1000515

# Submission time Handle Problem Language Result Execution time Memory
1000515 2024-06-17T16:20:58 Z LCJLY Self Study (JOI22_ho_t2) C++14
62 / 100
112 ms 11344 KB
#include <bits/stdc++.h>
using namespace std;
	
#define int long long 
#define ld long double
#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << "  " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << "  " << j << " " << #i << "  " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;
typedef pair<int,int>pii;
typedef array<int,3>pi2;
#define ll __int128

void solve(){	
	int n,m;
	cin >> n >> m;
	pii arr[n];
	for(int x=0;x<n;x++){
		cin >> arr[x].first;
	}	
	
	for(int x=0;x<n;x++){
		cin >> arr[x].second;
		arr[x].first=max(arr[x].first,arr[x].second);
	}
	
	int l=0;
	int r=1e15;
	int mid;
	int best=0;
	while(l<=r){
		mid=(l+r)/2;
		ll counter=0;
		for(int x=0;x<n;x++){
			ll hold=(mid+arr[x].first-1)/arr[x].first;
			if(hold<=m){
				counter+=hold;
			}
			else{
				counter+=m;
				ll hold2=(mid-arr[x].first*m);
				counter+=(hold2+arr[x].second-1)/arr[x].second;
			}
		}
		
		if(counter<=n*m){
			best=mid;
			l=mid+1;
		}
		else r=mid-1;
	}
	cout << best;
}	
 
int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin >> t;
	//freopen("in.txt","r",stdin);
	while(t--){
		solve();
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 456 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 2 ms 600 KB Output is correct
11 Correct 93 ms 10756 KB Output is correct
12 Correct 103 ms 10916 KB Output is correct
13 Correct 95 ms 8692 KB Output is correct
14 Correct 100 ms 8788 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 95 ms 6236 KB Output is correct
17 Correct 112 ms 11344 KB Output is correct
18 Correct 100 ms 10856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 95 ms 6236 KB Output is correct
3 Correct 112 ms 11344 KB Output is correct
4 Correct 100 ms 10856 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 456 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 460 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 92 ms 5676 KB Output is correct
14 Correct 37 ms 3932 KB Output is correct
15 Correct 24 ms 3076 KB Output is correct
16 Correct 21 ms 2392 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 2 ms 348 KB Output is correct
23 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 456 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 2 ms 600 KB Output is correct
11 Correct 93 ms 10756 KB Output is correct
12 Correct 103 ms 10916 KB Output is correct
13 Correct 95 ms 8692 KB Output is correct
14 Correct 100 ms 8788 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 456 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 460 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 92 ms 5676 KB Output is correct
24 Correct 37 ms 3932 KB Output is correct
25 Correct 24 ms 3076 KB Output is correct
26 Correct 21 ms 2392 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 2 ms 348 KB Output is correct
33 Correct 2 ms 604 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 95 ms 6236 KB Output is correct
36 Correct 112 ms 11344 KB Output is correct
37 Correct 100 ms 10856 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 344 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 352 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 2 ms 604 KB Output is correct
46 Correct 3 ms 604 KB Output is correct
47 Correct 0 ms 484 KB Output is correct
48 Correct 18 ms 2212 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 2 ms 604 KB Output is correct
52 Correct 0 ms 356 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 57 ms 5444 KB Output is correct
56 Correct 32 ms 3160 KB Output is correct
57 Correct 33 ms 3160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 456 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 460 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 92 ms 5676 KB Output is correct
10 Correct 37 ms 3932 KB Output is correct
11 Correct 24 ms 3076 KB Output is correct
12 Correct 21 ms 2392 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 2 ms 348 KB Output is correct
19 Correct 2 ms 604 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 95 ms 6236 KB Output is correct
22 Correct 112 ms 11344 KB Output is correct
23 Correct 100 ms 10856 KB Output is correct
24 Incorrect 18 ms 1880 KB Output isn't correct
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 456 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 2 ms 600 KB Output is correct
11 Correct 93 ms 10756 KB Output is correct
12 Correct 103 ms 10916 KB Output is correct
13 Correct 95 ms 8692 KB Output is correct
14 Correct 100 ms 8788 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 456 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 460 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 92 ms 5676 KB Output is correct
24 Correct 37 ms 3932 KB Output is correct
25 Correct 24 ms 3076 KB Output is correct
26 Correct 21 ms 2392 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 2 ms 348 KB Output is correct
33 Correct 2 ms 604 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 344 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 352 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 2 ms 604 KB Output is correct
42 Correct 3 ms 604 KB Output is correct
43 Correct 0 ms 484 KB Output is correct
44 Correct 18 ms 2212 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 2 ms 604 KB Output is correct
48 Correct 0 ms 356 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 57 ms 5444 KB Output is correct
52 Correct 32 ms 3160 KB Output is correct
53 Correct 33 ms 3160 KB Output is correct
54 Incorrect 18 ms 1880 KB Output isn't correct
55 Halted 0 ms 0 KB -