Submission #536780

# Submission time Handle Problem Language Result Execution time Memory
536780 2022-03-14T02:53:01 Z xp875 Self Study (JOI22_ho_t2) C++17
0 / 100
804 ms 4996 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  	ios_base::sync_with_stdio(0); cin.tie(0);
	ll n, m;
	cin >> n >> m;
	ll a[n], b[n];
	for(int i=0; i<n; i++) cin >> a[i];
	for(int i=0; i<n; i++) cin >> b[i];
	
	ll lo = 0, hi = (ll)1<<60;
	while(hi>lo) {
		ll x = (lo+hi)/2;
		ll ans = 0;
		for(int i=0; i<n; i++) {
			ll a1 = (x+b[i]-1)/b[i];
			ll a2 = (x+a[i]-1)/a[i];
			if(a2 > m) a2 = m + (x-a[i]*m+b[i]-1)/b[i];
			ans += min(a1, a2);
		}
		if(ans <= n*m) lo = x+1;
		else hi = x;
		
	}
	cout << lo-1;
	
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 6 ms 340 KB Output is correct
11 Correct 373 ms 4988 KB Output is correct
12 Correct 393 ms 4948 KB Output is correct
13 Correct 491 ms 4996 KB Output is correct
14 Incorrect 804 ms 4996 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 196 ms 2644 KB Output is correct
10 Correct 132 ms 1876 KB Output is correct
11 Correct 104 ms 1492 KB Output is correct
12 Correct 78 ms 1236 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Incorrect 13 ms 388 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 6 ms 340 KB Output is correct
11 Correct 373 ms 4988 KB Output is correct
12 Correct 393 ms 4948 KB Output is correct
13 Correct 491 ms 4996 KB Output is correct
14 Incorrect 804 ms 4996 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 196 ms 2644 KB Output is correct
10 Correct 132 ms 1876 KB Output is correct
11 Correct 104 ms 1492 KB Output is correct
12 Correct 78 ms 1236 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Incorrect 13 ms 388 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 6 ms 340 KB Output is correct
11 Correct 373 ms 4988 KB Output is correct
12 Correct 393 ms 4948 KB Output is correct
13 Correct 491 ms 4996 KB Output is correct
14 Incorrect 804 ms 4996 KB Output isn't correct
15 Halted 0 ms 0 KB -