Submission #527682

# Submission time Handle Problem Language Result Execution time Memory
527682 2022-02-18T02:24:39 Z 8e7 Self Study (JOI22_ho_t2) C++17
0 / 100
305 ms 5060 KB
//Challenge: Accepted
#include <bits/stdc++.h>
using namespace std;
#ifdef zisk
void debug(){cout << endl;}
template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);}
template<class T> void pary(T l, T r) {
	while (l != r) cout << *l << " ", l++;
	cout << endl;
}
#else
#define debug(...) 0
#define pary(...) 0
#endif
#define ll long long
#define maxn 300005
#define pii pair<int, int>
#define ff first
#define ss second
#define io ios_base::sync_with_stdio(0);cin.tie(0);
ll a[maxn], b[maxn];
int main() {
	io
	ll n, m;
	cin >> n >> m;
	for (int i = 0;i < n;i++) cin >> a[i];
	for (int i = 0;i < n;i++) cin >> b[i];
	ll low = 0, up = 1LL<<61;
	while (low < up - 1) {
		ll mid = (low + up) / 2, cnt = 0;
		for (int i = 0;i < n;i++) {
			if (b[i] >= a[i]) cnt += (mid + b[i] - 1) / b[i];
			else {
				if (mid > m * a[i]) cnt += m + (mid - m*a[i] + b[i] - 1) / b[i];
				else cnt += (mid + a[i] - 1) / a[i];
			}
		}
		if (cnt > n * m) up = mid;
		else low = mid;
	}
	cout << low << endl;
	
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 3 ms 332 KB Output is correct
11 Correct 163 ms 4956 KB Output is correct
12 Correct 166 ms 5060 KB Output is correct
13 Correct 152 ms 4988 KB Output is correct
14 Incorrect 305 ms 4988 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 81 ms 2668 KB Output is correct
10 Correct 54 ms 1860 KB Output is correct
11 Correct 41 ms 1484 KB Output is correct
12 Correct 33 ms 1244 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Incorrect 5 ms 332 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 3 ms 332 KB Output is correct
11 Correct 163 ms 4956 KB Output is correct
12 Correct 166 ms 5060 KB Output is correct
13 Correct 152 ms 4988 KB Output is correct
14 Incorrect 305 ms 4988 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 81 ms 2668 KB Output is correct
10 Correct 54 ms 1860 KB Output is correct
11 Correct 41 ms 1484 KB Output is correct
12 Correct 33 ms 1244 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Incorrect 5 ms 332 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 3 ms 332 KB Output is correct
11 Correct 163 ms 4956 KB Output is correct
12 Correct 166 ms 5060 KB Output is correct
13 Correct 152 ms 4988 KB Output is correct
14 Incorrect 305 ms 4988 KB Output isn't correct
15 Halted 0 ms 0 KB -