Submission #984782

# Submission time Handle Problem Language Result Execution time Memory
984782 2024-05-17T05:29:01 Z vjudge1 Self Study (JOI22_ho_t2) C++17
62 / 100
500 ms 11348 KB
#include<bits/stdc++.h>
#define ft first
#define sd second
#define pb push_back
#define nl "\n"
#define int ll
typedef long long ll;
typedef long double ld;
using namespace std;

const int mod = 1e9 + 7;
const int N = 2000;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int T = 1;
    while(T--) {
        int n, m;
        cin >> n >> m;
        int a[n + 1], b[n + 1], mn = 1e18, mx = 0;
        for (int i = 1; i <= n; i++) {
            cin >> a[i];
        }
        for (int i = 1; i <= n; i++) {
            cin >> b[i];
            a[i] = max(a[i], b[i]);
            mn = min( mn, a[i] * m);
            mx = max( mx, a[i] * m);
        }
        int l = mn, r = mx + 1;
        while(l + 1 < r) {
            int mid = (l + r) / 2;
            int s = 0;
            for (int i = 1; i <= n; i++) {
                if (m >= (mid - 1) / a[i] + 1) {
                    s += (m - ((mid - 1) / a[i] + 1));
                } else {
                    int res = mid - a[i] * m;
                    s -= ((res - 1) / b[i] + 1);
                }
            }
            if (s >= 0) {
                l = mid;
            } else {
                r = mid;
            }
        }
        cout << l << nl;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 86 ms 10836 KB Output is correct
12 Correct 85 ms 10832 KB Output is correct
13 Correct 37 ms 8788 KB Output is correct
14 Correct 38 ms 8712 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 25 ms 6288 KB Output is correct
17 Correct 49 ms 11344 KB Output is correct
18 Correct 89 ms 10740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 25 ms 6288 KB Output is correct
3 Correct 49 ms 11344 KB Output is correct
4 Correct 89 ms 10740 KB Output is correct
5 Correct 1 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 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 47 ms 5468 KB Output is correct
14 Correct 31 ms 3932 KB Output is correct
15 Correct 23 ms 2908 KB Output is correct
16 Correct 20 ms 2392 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 86 ms 10836 KB Output is correct
12 Correct 85 ms 10832 KB Output is correct
13 Correct 37 ms 8788 KB Output is correct
14 Correct 38 ms 8712 KB Output is correct
15 Correct 1 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 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 47 ms 5468 KB Output is correct
24 Correct 31 ms 3932 KB Output is correct
25 Correct 23 ms 2908 KB Output is correct
26 Correct 20 ms 2392 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 604 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 25 ms 6288 KB Output is correct
36 Correct 49 ms 11344 KB Output is correct
37 Correct 89 ms 10740 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 344 KB Output is correct
42 Correct 1 ms 344 KB Output is correct
43 Correct 1 ms 344 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 2 ms 604 KB Output is correct
46 Correct 3 ms 604 KB Output is correct
47 Correct 1 ms 512 KB Output is correct
48 Correct 16 ms 2008 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 2 ms 604 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 47 ms 5460 KB Output is correct
56 Correct 12 ms 3280 KB Output is correct
57 Correct 13 ms 3160 KB Output is correct
# 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 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 47 ms 5468 KB Output is correct
10 Correct 31 ms 3932 KB Output is correct
11 Correct 23 ms 2908 KB Output is correct
12 Correct 20 ms 2392 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 604 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 25 ms 6288 KB Output is correct
22 Correct 49 ms 11344 KB Output is correct
23 Correct 89 ms 10740 KB Output is correct
24 Correct 33 ms 2056 KB Output is correct
25 Correct 73 ms 5208 KB Output is correct
26 Correct 12 ms 1372 KB Output is correct
27 Correct 91 ms 10868 KB Output is correct
28 Correct 96 ms 10864 KB Output is correct
29 Correct 100 ms 10740 KB Output is correct
30 Correct 126 ms 10744 KB Output is correct
31 Correct 208 ms 10836 KB Output is correct
32 Correct 25 ms 6148 KB Output is correct
33 Correct 49 ms 11348 KB Output is correct
34 Incorrect 500 ms 6300 KB Output isn't correct
35 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 86 ms 10836 KB Output is correct
12 Correct 85 ms 10832 KB Output is correct
13 Correct 37 ms 8788 KB Output is correct
14 Correct 38 ms 8712 KB Output is correct
15 Correct 1 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 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 47 ms 5468 KB Output is correct
24 Correct 31 ms 3932 KB Output is correct
25 Correct 23 ms 2908 KB Output is correct
26 Correct 20 ms 2392 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 604 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 344 KB Output is correct
38 Correct 1 ms 344 KB Output is correct
39 Correct 1 ms 344 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 2 ms 604 KB Output is correct
42 Correct 3 ms 604 KB Output is correct
43 Correct 1 ms 512 KB Output is correct
44 Correct 16 ms 2008 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 2 ms 604 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 47 ms 5460 KB Output is correct
52 Correct 12 ms 3280 KB Output is correct
53 Correct 13 ms 3160 KB Output is correct
54 Correct 33 ms 2056 KB Output is correct
55 Correct 73 ms 5208 KB Output is correct
56 Correct 12 ms 1372 KB Output is correct
57 Correct 91 ms 10868 KB Output is correct
58 Correct 96 ms 10864 KB Output is correct
59 Correct 100 ms 10740 KB Output is correct
60 Correct 126 ms 10744 KB Output is correct
61 Correct 208 ms 10836 KB Output is correct
62 Correct 25 ms 6148 KB Output is correct
63 Correct 49 ms 11348 KB Output is correct
64 Incorrect 500 ms 6300 KB Output isn't correct
65 Halted 0 ms 0 KB -