//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;
*/
ll ans = 1LL<<60;
for (int i = 0;i < n;i++) ans = min(ans, max(a[i], b[i]));
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
53 ms |
4976 KB |
Output is correct |
12 |
Correct |
53 ms |
4988 KB |
Output is correct |
13 |
Correct |
47 ms |
4944 KB |
Output is correct |
14 |
Correct |
46 ms |
4968 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
27 ms |
5316 KB |
Output is correct |
17 |
Correct |
68 ms |
5748 KB |
Output is correct |
18 |
Correct |
54 ms |
6208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
27 ms |
5316 KB |
Output is correct |
3 |
Correct |
68 ms |
5748 KB |
Output is correct |
4 |
Correct |
54 ms |
6208 KB |
Output is correct |
5 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
53 ms |
4976 KB |
Output is correct |
12 |
Correct |
53 ms |
4988 KB |
Output is correct |
13 |
Correct |
47 ms |
4944 KB |
Output is correct |
14 |
Correct |
46 ms |
4968 KB |
Output is correct |
15 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
53 ms |
4976 KB |
Output is correct |
12 |
Correct |
53 ms |
4988 KB |
Output is correct |
13 |
Correct |
47 ms |
4944 KB |
Output is correct |
14 |
Correct |
46 ms |
4968 KB |
Output is correct |
15 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |