# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
548691 | 2022-04-14T09:16:57 Z | cpp219 | Self Study (JOI22_ho_t2) | C++17 | 280 ms | 9120 KB |
#include<bits/stdc++.h> #define ll long long #define ld long double #define fs first #define sc second #define debug(y) cout<<y,exit(0) using namespace std; typedef pair<ll,ll> LL; const ll N = 3e5 + 9; const ll inf = 1e18 + 7; int n,m,a[N],b[N]; bool chk(ll tar){ ll spare = 0; for (ll i = 1;i <= n;i++){ ll mx = max(a[i],b[i]); if (m*mx > tar) spare += m - ceil((ld)tar/mx); else spare -= ceil((ld)(tar - mx*m)/b[i]); } return (spare >= 0); } int main(){ ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0); #define task "tst" if (fopen(task".inp","r")){ freopen(task".inp","r",stdin); //freopen(task".out","w",stdout); } cin>>n>>m; for (ll i = 1;i <= n;i++) cin>>a[i]; for (ll i = 1;i <= n;i++) cin>>b[i]; ll l,mid,h; l = 1; h = inf; //debug(chk(18)); while(l <= h){ mid = (l + h)/2; if (chk(mid)) l = mid + 1; else h = mid - 1; } cout<<h; } /// be confident
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 12 ms | 340 KB | Output is correct |
11 | Correct | 224 ms | 2764 KB | Output is correct |
12 | Correct | 218 ms | 2632 KB | Output is correct |
13 | Correct | 219 ms | 2604 KB | Output is correct |
14 | Correct | 209 ms | 2864 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 165 ms | 2560 KB | Output is correct |
17 | Correct | 228 ms | 2544 KB | Output is correct |
18 | Correct | 223 ms | 2764 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 165 ms | 2560 KB | Output is correct |
3 | Correct | 228 ms | 2544 KB | Output is correct |
4 | Correct | 223 ms | 2764 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 139 ms | 1444 KB | Output is correct |
14 | Correct | 111 ms | 1108 KB | Output is correct |
15 | Correct | 93 ms | 900 KB | Output is correct |
16 | Correct | 97 ms | 776 KB | Output is correct |
17 | Correct | 2 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 4 ms | 340 KB | Output is correct |
23 | Correct | 9 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 12 ms | 340 KB | Output is correct |
11 | Correct | 224 ms | 2764 KB | Output is correct |
12 | Correct | 218 ms | 2632 KB | Output is correct |
13 | Correct | 219 ms | 2604 KB | Output is correct |
14 | Correct | 209 ms | 2864 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 0 ms | 212 KB | Output is correct |
23 | Correct | 139 ms | 1444 KB | Output is correct |
24 | Correct | 111 ms | 1108 KB | Output is correct |
25 | Correct | 93 ms | 900 KB | Output is correct |
26 | Correct | 97 ms | 776 KB | Output is correct |
27 | Correct | 2 ms | 212 KB | Output is correct |
28 | Correct | 0 ms | 212 KB | Output is correct |
29 | Correct | 0 ms | 212 KB | Output is correct |
30 | Correct | 1 ms | 212 KB | Output is correct |
31 | Correct | 1 ms | 212 KB | Output is correct |
32 | Correct | 4 ms | 340 KB | Output is correct |
33 | Correct | 9 ms | 340 KB | Output is correct |
34 | Correct | 0 ms | 212 KB | Output is correct |
35 | Correct | 165 ms | 2560 KB | Output is correct |
36 | Correct | 228 ms | 2544 KB | Output is correct |
37 | Correct | 223 ms | 2764 KB | Output is correct |
38 | Correct | 0 ms | 212 KB | Output is correct |
39 | Correct | 0 ms | 212 KB | Output is correct |
40 | Correct | 1 ms | 340 KB | Output is correct |
41 | Correct | 0 ms | 212 KB | Output is correct |
42 | Correct | 1 ms | 212 KB | Output is correct |
43 | Correct | 0 ms | 212 KB | Output is correct |
44 | Correct | 1 ms | 324 KB | Output is correct |
45 | Correct | 16 ms | 372 KB | Output is correct |
46 | Correct | 24 ms | 408 KB | Output is correct |
47 | Correct | 4 ms | 340 KB | Output is correct |
48 | Correct | 86 ms | 724 KB | Output is correct |
49 | Correct | 0 ms | 212 KB | Output is correct |
50 | Correct | 1 ms | 340 KB | Output is correct |
51 | Correct | 14 ms | 368 KB | Output is correct |
52 | Correct | 0 ms | 212 KB | Output is correct |
53 | Correct | 0 ms | 212 KB | Output is correct |
54 | Correct | 1 ms | 212 KB | Output is correct |
55 | Correct | 137 ms | 1356 KB | Output is correct |
56 | Correct | 97 ms | 1108 KB | Output is correct |
57 | Correct | 86 ms | 1108 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 139 ms | 1444 KB | Output is correct |
10 | Correct | 111 ms | 1108 KB | Output is correct |
11 | Correct | 93 ms | 900 KB | Output is correct |
12 | Correct | 97 ms | 776 KB | Output is correct |
13 | Correct | 2 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 4 ms | 340 KB | Output is correct |
19 | Correct | 9 ms | 340 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 165 ms | 2560 KB | Output is correct |
22 | Correct | 228 ms | 2544 KB | Output is correct |
23 | Correct | 223 ms | 2764 KB | Output is correct |
24 | Correct | 122 ms | 672 KB | Output is correct |
25 | Correct | 138 ms | 1356 KB | Output is correct |
26 | Correct | 60 ms | 460 KB | Output is correct |
27 | Correct | 230 ms | 2660 KB | Output is correct |
28 | Correct | 228 ms | 2652 KB | Output is correct |
29 | Correct | 265 ms | 2604 KB | Output is correct |
30 | Correct | 231 ms | 2624 KB | Output is correct |
31 | Correct | 248 ms | 2632 KB | Output is correct |
32 | Correct | 179 ms | 3832 KB | Output is correct |
33 | Correct | 280 ms | 9120 KB | Output is correct |
34 | Correct | 171 ms | 3916 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 12 ms | 340 KB | Output is correct |
11 | Correct | 224 ms | 2764 KB | Output is correct |
12 | Correct | 218 ms | 2632 KB | Output is correct |
13 | Correct | 219 ms | 2604 KB | Output is correct |
14 | Correct | 209 ms | 2864 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 0 ms | 212 KB | Output is correct |
23 | Correct | 139 ms | 1444 KB | Output is correct |
24 | Correct | 111 ms | 1108 KB | Output is correct |
25 | Correct | 93 ms | 900 KB | Output is correct |
26 | Correct | 97 ms | 776 KB | Output is correct |
27 | Correct | 2 ms | 212 KB | Output is correct |
28 | Correct | 0 ms | 212 KB | Output is correct |
29 | Correct | 0 ms | 212 KB | Output is correct |
30 | Correct | 1 ms | 212 KB | Output is correct |
31 | Correct | 1 ms | 212 KB | Output is correct |
32 | Correct | 4 ms | 340 KB | Output is correct |
33 | Correct | 9 ms | 340 KB | Output is correct |
34 | Correct | 0 ms | 212 KB | Output is correct |
35 | Correct | 0 ms | 212 KB | Output is correct |
36 | Correct | 1 ms | 340 KB | Output is correct |
37 | Correct | 0 ms | 212 KB | Output is correct |
38 | Correct | 1 ms | 212 KB | Output is correct |
39 | Correct | 0 ms | 212 KB | Output is correct |
40 | Correct | 1 ms | 324 KB | Output is correct |
41 | Correct | 16 ms | 372 KB | Output is correct |
42 | Correct | 24 ms | 408 KB | Output is correct |
43 | Correct | 4 ms | 340 KB | Output is correct |
44 | Correct | 86 ms | 724 KB | Output is correct |
45 | Correct | 0 ms | 212 KB | Output is correct |
46 | Correct | 1 ms | 340 KB | Output is correct |
47 | Correct | 14 ms | 368 KB | Output is correct |
48 | Correct | 0 ms | 212 KB | Output is correct |
49 | Correct | 0 ms | 212 KB | Output is correct |
50 | Correct | 1 ms | 212 KB | Output is correct |
51 | Correct | 137 ms | 1356 KB | Output is correct |
52 | Correct | 97 ms | 1108 KB | Output is correct |
53 | Correct | 86 ms | 1108 KB | Output is correct |
54 | Correct | 122 ms | 672 KB | Output is correct |
55 | Correct | 138 ms | 1356 KB | Output is correct |
56 | Correct | 60 ms | 460 KB | Output is correct |
57 | Correct | 230 ms | 2660 KB | Output is correct |
58 | Correct | 228 ms | 2652 KB | Output is correct |
59 | Correct | 265 ms | 2604 KB | Output is correct |
60 | Correct | 231 ms | 2624 KB | Output is correct |
61 | Correct | 248 ms | 2632 KB | Output is correct |
62 | Correct | 179 ms | 3832 KB | Output is correct |
63 | Correct | 280 ms | 9120 KB | Output is correct |
64 | Correct | 171 ms | 3916 KB | Output is correct |
65 | Correct | 0 ms | 212 KB | Output is correct |
66 | Correct | 165 ms | 2560 KB | Output is correct |
67 | Correct | 228 ms | 2544 KB | Output is correct |
68 | Correct | 223 ms | 2764 KB | Output is correct |
69 | Correct | 67 ms | 1196 KB | Output is correct |
70 | Correct | 32 ms | 532 KB | Output is correct |
71 | Correct | 1 ms | 212 KB | Output is correct |
72 | Correct | 64 ms | 1492 KB | Output is correct |
73 | Correct | 6 ms | 596 KB | Output is correct |
74 | Correct | 1 ms | 340 KB | Output is correct |
75 | Correct | 234 ms | 8480 KB | Output is correct |
76 | Correct | 248 ms | 8460 KB | Output is correct |
77 | Correct | 237 ms | 8464 KB | Output is correct |
78 | Correct | 265 ms | 8524 KB | Output is correct |
79 | Correct | 256 ms | 8428 KB | Output is correct |
80 | Correct | 269 ms | 8484 KB | Output is correct |
81 | Correct | 220 ms | 6472 KB | Output is correct |
82 | Correct | 242 ms | 6472 KB | Output is correct |