# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
875023 |
2023-11-18T13:57:38 Z |
makrav |
Self Study (JOI22_ho_t2) |
C++14 |
|
54 ms |
11432 KB |
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vei;
typedef vector<vei> vevei;
#define all(a) (a).begin(), (a).end()
#define sz(a) (int) a.size()
#define con cout << "NO\n"
#define coe cout << "YES\n";
#define str string
#define pb push_back
#define ff first
#define sc second
#define ss second
#define pii pair<int, int>
#define mxe max_element
#define mne min_element
#define stf shrink_to_fit
#define f(i, l, r) for (int i = (l); i < (r); i++)
#define double ld
#define int ll
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n, m; cin >> n >> m;
vector<int> a(n), b(n);
f(i, 0, n) cin >> a[i];
f(i, 0, n) cin >> b[i];
int ans = 1e18;
f(i, 0, n) {
ans = min(ans, max(a[i], b[i]));
}
cout << ans << '\n';
return 0;
int L = -1, R = 1e14;
while (R - L > 1) {
int M = (L + R) / 2;
int need = 0;
f(i, 0, n) {
if (b[i] > a[i]) {
need += (M + b[i] - 1) / b[i];
}
else {
if ((M + a[i] - 1) / a[i] <= m) {
need += (M + a[i] - 1) / a[i];
}
else {
need += m + (M - a[i] * m + b[i] - 1) / b[i];
}
}
}
if (need > m * n) R = M;
else L = M;
}
cout << L << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
45 ms |
5136 KB |
Output is correct |
12 |
Correct |
52 ms |
5160 KB |
Output is correct |
13 |
Correct |
35 ms |
5168 KB |
Output is correct |
14 |
Correct |
38 ms |
4956 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
24 ms |
6168 KB |
Output is correct |
17 |
Correct |
54 ms |
11432 KB |
Output is correct |
18 |
Correct |
47 ms |
10904 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
24 ms |
6168 KB |
Output is correct |
3 |
Correct |
54 ms |
11432 KB |
Output is correct |
4 |
Correct |
47 ms |
10904 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
45 ms |
5136 KB |
Output is correct |
12 |
Correct |
52 ms |
5160 KB |
Output is correct |
13 |
Correct |
35 ms |
5168 KB |
Output is correct |
14 |
Correct |
38 ms |
4956 KB |
Output is correct |
15 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
45 ms |
5136 KB |
Output is correct |
12 |
Correct |
52 ms |
5160 KB |
Output is correct |
13 |
Correct |
35 ms |
5168 KB |
Output is correct |
14 |
Correct |
38 ms |
4956 KB |
Output is correct |
15 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |