# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
780995 |
2023-07-12T15:29:50 Z |
ymm |
Self Study (JOI22_ho_t2) |
C++17 |
|
434 ms |
10808 KB |
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
int main()
{
cin.tie(0) -> sync_with_stdio(false);
ll n, m;
cin >> n >> m;
vector<ll> a(n), b(n);
for (auto &x : a)
cin >> x;
Loop (i,0,n) {
cin >> b[i];
a[i] = max(a[i], b[i]);
}
ll l = 0, r = 1e18;
while (l < r) {
ll target = (l+r+1)/2;
ll cnt = 0;
Loop (i,0,n) {
ll x = (target+a[i]-1)/a[i];
x = min(x, m);
if (x*a[i] < target)
x += (target - x*a[i] + b[i]-1)/b[i];
cnt += x;
}
if (cnt <= n*m)
l = target;
else
r = target-1;
}
cout << l << '\n';
}
# |
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 |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
252 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
4 ms |
468 KB |
Output is correct |
11 |
Correct |
204 ms |
10808 KB |
Output is correct |
12 |
Correct |
226 ms |
10804 KB |
Output is correct |
13 |
Correct |
211 ms |
8820 KB |
Output is correct |
14 |
Incorrect |
434 ms |
8820 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 |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
320 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
324 KB |
Output is correct |
6 |
Correct |
1 ms |
316 KB |
Output is correct |
7 |
Correct |
1 ms |
320 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
117 ms |
5564 KB |
Output is correct |
10 |
Correct |
71 ms |
3784 KB |
Output is correct |
11 |
Correct |
55 ms |
2896 KB |
Output is correct |
12 |
Correct |
45 ms |
2408 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
324 KB |
Output is correct |
18 |
Incorrect |
9 ms |
332 KB |
Output isn't correct |
19 |
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 |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
252 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
4 ms |
468 KB |
Output is correct |
11 |
Correct |
204 ms |
10808 KB |
Output is correct |
12 |
Correct |
226 ms |
10804 KB |
Output is correct |
13 |
Correct |
211 ms |
8820 KB |
Output is correct |
14 |
Incorrect |
434 ms |
8820 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 |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
320 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
324 KB |
Output is correct |
6 |
Correct |
1 ms |
316 KB |
Output is correct |
7 |
Correct |
1 ms |
320 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
117 ms |
5564 KB |
Output is correct |
10 |
Correct |
71 ms |
3784 KB |
Output is correct |
11 |
Correct |
55 ms |
2896 KB |
Output is correct |
12 |
Correct |
45 ms |
2408 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
324 KB |
Output is correct |
18 |
Incorrect |
9 ms |
332 KB |
Output isn't correct |
19 |
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 |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
252 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
4 ms |
468 KB |
Output is correct |
11 |
Correct |
204 ms |
10808 KB |
Output is correct |
12 |
Correct |
226 ms |
10804 KB |
Output is correct |
13 |
Correct |
211 ms |
8820 KB |
Output is correct |
14 |
Incorrect |
434 ms |
8820 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |