# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
991560 | 2024-06-02T12:54:51 Z | rsinventor | Self Study (JOI22_ho_t2) | C++17 | 107 ms | 11604 KB |
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ll; typedef vector<int> vi; typedef vector <ll> vll; typedef vector<bool> vb; typedef vector <string> vs; typedef vector<char> vc; typedef pair<int, int> pii; typedef vector <pii> vpii; #define all(a) (a).begin(), (a).end() #define pb push_back #define endl "\n" ll n, m; ll adds(ll mid, vll& a, vll& b) { ll sum = 0; for(int i = 0; i < a.size(); i++) { if(a[i]>b[i]) { ll class_cnt = 1 + ((mid - 1) / a[i]); if (class_cnt > m) { sum += 1 + ((mid - a[i] * m - 1) / b[i]) + m; } else { sum += class_cnt; } } else { sum += 1 + ((mid-1)/b[i]); } } return sum; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> m; vll a(n); for(int i = 0; i < n; i++) { cin >> a[i]; } vll b(n); for(int i = 0; i < n; i++) { cin >> b[i]; } ll l = 0; ll r = 50000000000000; while(l<r) { ll mid = l + (r - l)/2; if(adds(mid, a, b)<=n*m) { l = mid+1; } else { r = mid; } } cout << l-1 << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 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 | 344 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 2 ms | 604 KB | Output is correct |
11 | Correct | 98 ms | 10904 KB | Output is correct |
12 | Correct | 107 ms | 10836 KB | Output is correct |
13 | Correct | 65 ms | 8728 KB | Output is correct |
14 | Correct | 83 ms | 9212 KB | Output is correct |
15 | Correct | 0 ms | 596 KB | Output is correct |
16 | Correct | 52 ms | 6236 KB | Output is correct |
17 | Correct | 79 ms | 11604 KB | Output is correct |
18 | Correct | 70 ms | 10860 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 596 KB | Output is correct |
2 | Correct | 52 ms | 6236 KB | Output is correct |
3 | Correct | 79 ms | 11604 KB | Output is correct |
4 | Correct | 70 ms | 10860 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 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 | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 36 ms | 5592 KB | Output is correct |
14 | Correct | 24 ms | 3932 KB | Output is correct |
15 | Correct | 18 ms | 2908 KB | Output is correct |
16 | Correct | 15 ms | 2572 KB | Output is correct |
17 | Correct | 1 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 600 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Incorrect | 0 ms | 456 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 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 | 344 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 2 ms | 604 KB | Output is correct |
11 | Correct | 98 ms | 10904 KB | Output is correct |
12 | Correct | 107 ms | 10836 KB | Output is correct |
13 | Correct | 65 ms | 8728 KB | Output is correct |
14 | Correct | 83 ms | 9212 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 1 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 0 ms | 348 KB | Output is correct |
22 | Correct | 0 ms | 348 KB | Output is correct |
23 | Correct | 36 ms | 5592 KB | Output is correct |
24 | Correct | 24 ms | 3932 KB | Output is correct |
25 | Correct | 18 ms | 2908 KB | Output is correct |
26 | Correct | 15 ms | 2572 KB | Output is correct |
27 | Correct | 1 ms | 348 KB | Output is correct |
28 | Correct | 0 ms | 348 KB | Output is correct |
29 | Correct | 0 ms | 600 KB | Output is correct |
30 | Correct | 0 ms | 348 KB | Output is correct |
31 | Incorrect | 0 ms | 456 KB | Output isn't correct |
32 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 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 | 36 ms | 5592 KB | Output is correct |
10 | Correct | 24 ms | 3932 KB | Output is correct |
11 | Correct | 18 ms | 2908 KB | Output is correct |
12 | Correct | 15 ms | 2572 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 600 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Incorrect | 0 ms | 456 KB | Output isn't correct |
18 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 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 | 344 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 2 ms | 604 KB | Output is correct |
11 | Correct | 98 ms | 10904 KB | Output is correct |
12 | Correct | 107 ms | 10836 KB | Output is correct |
13 | Correct | 65 ms | 8728 KB | Output is correct |
14 | Correct | 83 ms | 9212 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 1 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 0 ms | 348 KB | Output is correct |
22 | Correct | 0 ms | 348 KB | Output is correct |
23 | Correct | 36 ms | 5592 KB | Output is correct |
24 | Correct | 24 ms | 3932 KB | Output is correct |
25 | Correct | 18 ms | 2908 KB | Output is correct |
26 | Correct | 15 ms | 2572 KB | Output is correct |
27 | Correct | 1 ms | 348 KB | Output is correct |
28 | Correct | 0 ms | 348 KB | Output is correct |
29 | Correct | 0 ms | 600 KB | Output is correct |
30 | Correct | 0 ms | 348 KB | Output is correct |
31 | Incorrect | 0 ms | 456 KB | Output isn't correct |
32 | Halted | 0 ms | 0 KB | - |