답안 #527680

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
527680 2022-02-18T02:16:45 Z 8e7 Self Study (JOI22_ho_t2) C++17
0 / 100
304 ms 9540 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<<60;
	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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 320 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 316 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 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 4 ms 460 KB Output is correct
11 Correct 167 ms 9540 KB Output is correct
12 Correct 191 ms 9376 KB Output is correct
13 Correct 155 ms 6596 KB Output is correct
14 Incorrect 304 ms 8636 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 216 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 84 ms 4788 KB Output is correct
10 Correct 56 ms 2688 KB Output is correct
11 Correct 43 ms 2052 KB Output is correct
12 Correct 41 ms 1824 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Incorrect 5 ms 460 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 320 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 316 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 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 4 ms 460 KB Output is correct
11 Correct 167 ms 9540 KB Output is correct
12 Correct 191 ms 9376 KB Output is correct
13 Correct 155 ms 6596 KB Output is correct
14 Incorrect 304 ms 8636 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 216 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 84 ms 4788 KB Output is correct
10 Correct 56 ms 2688 KB Output is correct
11 Correct 43 ms 2052 KB Output is correct
12 Correct 41 ms 1824 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Incorrect 5 ms 460 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 320 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 316 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 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 4 ms 460 KB Output is correct
11 Correct 167 ms 9540 KB Output is correct
12 Correct 191 ms 9376 KB Output is correct
13 Correct 155 ms 6596 KB Output is correct
14 Incorrect 304 ms 8636 KB Output isn't correct
15 Halted 0 ms 0 KB -