# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
938054 | 2024-03-04T18:46:54 Z | vjudge1 | Self Study (JOI22_ho_t2) | C++17 | 290 ms | 7484 KB |
#include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" vector<pair<int,int>> v; int n,m; bool check(int mid){ vector<int> need(n); int left = 0; for(int i = 0; i<n && left >= 0; i++){ int z = max(v[i].first, v[i].second); int k = (mid+z-1)/z; if(k > m) need[i] = mid-(m * z); else left+=m-k; } for(int i = 0; i<n && left >= 0; i++){ left -= (need[i] + v[i].second - 1)/v[i].second; } return left>=0; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin>>n>>m; v.resize(n); for(auto& x : v) cin>>x.first; for(auto& x : v) cin>>x.second; int l = 0; int r = 1e18; while(r > l+1){ int mid = (l+r)/2; if(check(mid)) l = mid; else r = mid; } cout<<l<<endl; }
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 | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 3 ms | 348 KB | Output is correct |
11 | Correct | 170 ms | 7448 KB | Output is correct |
12 | Correct | 163 ms | 7452 KB | Output is correct |
13 | Correct | 156 ms | 7464 KB | Output is correct |
14 | Correct | 163 ms | 7452 KB | Output is correct |
15 | Correct | 0 ms | 344 KB | Output is correct |
16 | Correct | 183 ms | 7472 KB | Output is correct |
17 | Correct | 166 ms | 7460 KB | Output is correct |
18 | Correct | 165 ms | 7464 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 183 ms | 7472 KB | Output is correct |
3 | Correct | 166 ms | 7460 KB | Output is correct |
4 | Correct | 165 ms | 7464 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 544 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 | 1 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 | 94 ms | 3932 KB | Output is correct |
14 | Correct | 63 ms | 2648 KB | Output is correct |
15 | Correct | 46 ms | 2140 KB | Output is correct |
16 | Correct | 41 ms | 1880 KB | Output is correct |
17 | Correct | 1 ms | 344 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 | 3 ms | 564 KB | Output is correct |
23 | Correct | 3 ms | 348 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 | 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 | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 3 ms | 348 KB | Output is correct |
11 | Correct | 170 ms | 7448 KB | Output is correct |
12 | Correct | 163 ms | 7452 KB | Output is correct |
13 | Correct | 156 ms | 7464 KB | Output is correct |
14 | Correct | 163 ms | 7452 KB | Output is correct |
15 | Correct | 0 ms | 344 KB | Output is correct |
16 | Correct | 1 ms | 544 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 1 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 | 94 ms | 3932 KB | Output is correct |
24 | Correct | 63 ms | 2648 KB | Output is correct |
25 | Correct | 46 ms | 2140 KB | Output is correct |
26 | Correct | 41 ms | 1880 KB | Output is correct |
27 | Correct | 1 ms | 344 KB | Output is correct |
28 | Correct | 0 ms | 348 KB | Output is correct |
29 | Correct | 0 ms | 348 KB | Output is correct |
30 | Correct | 0 ms | 348 KB | Output is correct |
31 | Correct | 0 ms | 348 KB | Output is correct |
32 | Correct | 3 ms | 564 KB | Output is correct |
33 | Correct | 3 ms | 348 KB | Output is correct |
34 | Correct | 0 ms | 344 KB | Output is correct |
35 | Correct | 183 ms | 7472 KB | Output is correct |
36 | Correct | 166 ms | 7460 KB | Output is correct |
37 | Correct | 165 ms | 7464 KB | Output is correct |
38 | Correct | 1 ms | 344 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 | 348 KB | Output is correct |
42 | Correct | 0 ms | 348 KB | Output is correct |
43 | Correct | 0 ms | 344 KB | Output is correct |
44 | Correct | 0 ms | 348 KB | Output is correct |
45 | Correct | 4 ms | 348 KB | Output is correct |
46 | Correct | 6 ms | 604 KB | Output is correct |
47 | Correct | 1 ms | 348 KB | Output is correct |
48 | Correct | 33 ms | 1628 KB | Output is correct |
49 | Correct | 1 ms | 348 KB | Output is correct |
50 | Correct | 0 ms | 348 KB | Output is correct |
51 | Correct | 4 ms | 348 KB | Output is correct |
52 | Correct | 0 ms | 348 KB | Output is correct |
53 | Correct | 0 ms | 348 KB | Output is correct |
54 | Correct | 1 ms | 348 KB | Output is correct |
55 | Correct | 94 ms | 3932 KB | Output is correct |
56 | Correct | 54 ms | 2648 KB | Output is correct |
57 | Correct | 53 ms | 2816 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 544 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 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 | 94 ms | 3932 KB | Output is correct |
10 | Correct | 63 ms | 2648 KB | Output is correct |
11 | Correct | 46 ms | 2140 KB | Output is correct |
12 | Correct | 41 ms | 1880 KB | Output is correct |
13 | Correct | 1 ms | 344 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 3 ms | 564 KB | Output is correct |
19 | Correct | 3 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 344 KB | Output is correct |
21 | Correct | 183 ms | 7472 KB | Output is correct |
22 | Correct | 166 ms | 7460 KB | Output is correct |
23 | Correct | 165 ms | 7464 KB | Output is correct |
24 | Correct | 41 ms | 1520 KB | Output is correct |
25 | Correct | 116 ms | 3600 KB | Output is correct |
26 | Correct | 22 ms | 1120 KB | Output is correct |
27 | Correct | 182 ms | 7468 KB | Output is correct |
28 | Correct | 205 ms | 7484 KB | Output is correct |
29 | Correct | 194 ms | 7464 KB | Output is correct |
30 | Correct | 218 ms | 7464 KB | Output is correct |
31 | Correct | 277 ms | 7468 KB | Output is correct |
32 | Correct | 220 ms | 7472 KB | Output is correct |
33 | Incorrect | 290 ms | 7468 KB | Output isn't correct |
34 | 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 | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 3 ms | 348 KB | Output is correct |
11 | Correct | 170 ms | 7448 KB | Output is correct |
12 | Correct | 163 ms | 7452 KB | Output is correct |
13 | Correct | 156 ms | 7464 KB | Output is correct |
14 | Correct | 163 ms | 7452 KB | Output is correct |
15 | Correct | 0 ms | 344 KB | Output is correct |
16 | Correct | 1 ms | 544 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 1 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 | 94 ms | 3932 KB | Output is correct |
24 | Correct | 63 ms | 2648 KB | Output is correct |
25 | Correct | 46 ms | 2140 KB | Output is correct |
26 | Correct | 41 ms | 1880 KB | Output is correct |
27 | Correct | 1 ms | 344 KB | Output is correct |
28 | Correct | 0 ms | 348 KB | Output is correct |
29 | Correct | 0 ms | 348 KB | Output is correct |
30 | Correct | 0 ms | 348 KB | Output is correct |
31 | Correct | 0 ms | 348 KB | Output is correct |
32 | Correct | 3 ms | 564 KB | Output is correct |
33 | Correct | 3 ms | 348 KB | Output is correct |
34 | Correct | 1 ms | 344 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 | 348 KB | Output is correct |
38 | Correct | 0 ms | 348 KB | Output is correct |
39 | Correct | 0 ms | 344 KB | Output is correct |
40 | Correct | 0 ms | 348 KB | Output is correct |
41 | Correct | 4 ms | 348 KB | Output is correct |
42 | Correct | 6 ms | 604 KB | Output is correct |
43 | Correct | 1 ms | 348 KB | Output is correct |
44 | Correct | 33 ms | 1628 KB | Output is correct |
45 | Correct | 1 ms | 348 KB | Output is correct |
46 | Correct | 0 ms | 348 KB | Output is correct |
47 | Correct | 4 ms | 348 KB | Output is correct |
48 | Correct | 0 ms | 348 KB | Output is correct |
49 | Correct | 0 ms | 348 KB | Output is correct |
50 | Correct | 1 ms | 348 KB | Output is correct |
51 | Correct | 94 ms | 3932 KB | Output is correct |
52 | Correct | 54 ms | 2648 KB | Output is correct |
53 | Correct | 53 ms | 2816 KB | Output is correct |
54 | Correct | 41 ms | 1520 KB | Output is correct |
55 | Correct | 116 ms | 3600 KB | Output is correct |
56 | Correct | 22 ms | 1120 KB | Output is correct |
57 | Correct | 182 ms | 7468 KB | Output is correct |
58 | Correct | 205 ms | 7484 KB | Output is correct |
59 | Correct | 194 ms | 7464 KB | Output is correct |
60 | Correct | 218 ms | 7464 KB | Output is correct |
61 | Correct | 277 ms | 7468 KB | Output is correct |
62 | Correct | 220 ms | 7472 KB | Output is correct |
63 | Incorrect | 290 ms | 7468 KB | Output isn't correct |
64 | Halted | 0 ms | 0 KB | - |