# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
638707 | 2022-09-07T04:33:26 Z | jamezzz | Self Study (JOI22_ho_t2) | C++17 | 635 ms | 9228 KB |
#include <bits/stdc++.h> using namespace std; #define pf printf #define sf scanf typedef long long ll; typedef pair<int,int> ii; #define maxn 300005 int n,m,a[maxn],b[maxn]; int main(){ sf("%d%d",&n,&m); for(int i=0;i<n;++i){ sf("%d",&a[i]); } for(int i=0;i<n;++i){ sf("%d",&b[i]); } ll lo=0,hi=1e18+10,mid,res=0; while(lo<=hi){ mid=(lo+hi)>>1; ll rem=(ll)n*m; for(int i=0;i<n;++i){ ll take=min((ll)m,(mid+a[i]-1)/a[i]); ll self=max((mid-(take*a[i])+b[i]-1)/b[i],0ll); ll self2=(mid+b[i]-1)/b[i]; rem-=min(take+self,self2); if(rem<0)break; } if(rem>=0){ res=mid; lo=mid+1; } else hi=mid-1; } pf("%lld\n",res); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 | 0 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 | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 3 ms | 340 KB | Output is correct |
11 | Correct | 181 ms | 2524 KB | Output is correct |
12 | Correct | 174 ms | 2728 KB | Output is correct |
13 | Correct | 182 ms | 2560 KB | Output is correct |
14 | Correct | 150 ms | 2628 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 50 ms | 3796 KB | Output is correct |
17 | Correct | 163 ms | 9228 KB | Output is correct |
18 | Correct | 174 ms | 8400 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 50 ms | 3796 KB | Output is correct |
3 | Correct | 163 ms | 9228 KB | Output is correct |
4 | Correct | 174 ms | 8400 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 | 240 KB | Output is correct |
9 | Correct | 1 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 | 88 ms | 1460 KB | Output is correct |
14 | Correct | 59 ms | 1044 KB | Output is correct |
15 | Correct | 42 ms | 852 KB | Output is correct |
16 | Correct | 38 ms | 880 KB | Output is correct |
17 | Correct | 1 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 | 2 ms | 340 KB | Output is correct |
23 | Correct | 4 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 0 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 | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 3 ms | 340 KB | Output is correct |
11 | Correct | 181 ms | 2524 KB | Output is correct |
12 | Correct | 174 ms | 2728 KB | Output is correct |
13 | Correct | 182 ms | 2560 KB | Output is correct |
14 | Correct | 150 ms | 2628 KB | Output is correct |
15 | Correct | 0 ms | 212 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 | 240 KB | Output is correct |
19 | Correct | 1 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 | 88 ms | 1460 KB | Output is correct |
24 | Correct | 59 ms | 1044 KB | Output is correct |
25 | Correct | 42 ms | 852 KB | Output is correct |
26 | Correct | 38 ms | 880 KB | Output is correct |
27 | Correct | 1 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 | 0 ms | 212 KB | Output is correct |
31 | Correct | 0 ms | 212 KB | Output is correct |
32 | Correct | 2 ms | 340 KB | Output is correct |
33 | Correct | 4 ms | 340 KB | Output is correct |
34 | Correct | 0 ms | 212 KB | Output is correct |
35 | Correct | 50 ms | 3796 KB | Output is correct |
36 | Correct | 163 ms | 9228 KB | Output is correct |
37 | Correct | 174 ms | 8400 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 | 212 KB | Output is correct |
41 | Correct | 0 ms | 212 KB | Output is correct |
42 | Correct | 0 ms | 212 KB | Output is correct |
43 | Correct | 0 ms | 212 KB | Output is correct |
44 | Correct | 1 ms | 308 KB | Output is correct |
45 | Correct | 4 ms | 452 KB | Output is correct |
46 | Correct | 6 ms | 468 KB | Output is correct |
47 | Correct | 1 ms | 316 KB | Output is correct |
48 | Correct | 34 ms | 1692 KB | Output is correct |
49 | Correct | 0 ms | 212 KB | Output is correct |
50 | Correct | 1 ms | 212 KB | Output is correct |
51 | Correct | 5 ms | 340 KB | Output is correct |
52 | Correct | 1 ms | 308 KB | Output is correct |
53 | Correct | 1 ms | 212 KB | Output is correct |
54 | Correct | 1 ms | 304 KB | Output is correct |
55 | Correct | 93 ms | 4324 KB | Output is correct |
56 | Correct | 72 ms | 2248 KB | Output is correct |
57 | Correct | 54 ms | 2272 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 0 ms | 240 KB | Output is correct |
5 | Correct | 1 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 | 88 ms | 1460 KB | Output is correct |
10 | Correct | 59 ms | 1044 KB | Output is correct |
11 | Correct | 42 ms | 852 KB | Output is correct |
12 | Correct | 38 ms | 880 KB | Output is correct |
13 | Correct | 1 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 | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 2 ms | 340 KB | Output is correct |
19 | Correct | 4 ms | 340 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 50 ms | 3796 KB | Output is correct |
22 | Correct | 163 ms | 9228 KB | Output is correct |
23 | Correct | 174 ms | 8400 KB | Output is correct |
24 | Correct | 61 ms | 1468 KB | Output is correct |
25 | Correct | 146 ms | 3944 KB | Output is correct |
26 | Correct | 23 ms | 1168 KB | Output is correct |
27 | Correct | 172 ms | 8320 KB | Output is correct |
28 | Correct | 189 ms | 8524 KB | Output is correct |
29 | Correct | 213 ms | 8440 KB | Output is correct |
30 | Correct | 241 ms | 8388 KB | Output is correct |
31 | Correct | 430 ms | 8432 KB | Output is correct |
32 | Correct | 265 ms | 3800 KB | Output is correct |
33 | Correct | 491 ms | 9096 KB | Output is correct |
34 | Correct | 271 ms | 3800 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 0 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 | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 3 ms | 340 KB | Output is correct |
11 | Correct | 181 ms | 2524 KB | Output is correct |
12 | Correct | 174 ms | 2728 KB | Output is correct |
13 | Correct | 182 ms | 2560 KB | Output is correct |
14 | Correct | 150 ms | 2628 KB | Output is correct |
15 | Correct | 0 ms | 212 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 | 240 KB | Output is correct |
19 | Correct | 1 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 | 88 ms | 1460 KB | Output is correct |
24 | Correct | 59 ms | 1044 KB | Output is correct |
25 | Correct | 42 ms | 852 KB | Output is correct |
26 | Correct | 38 ms | 880 KB | Output is correct |
27 | Correct | 1 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 | 0 ms | 212 KB | Output is correct |
31 | Correct | 0 ms | 212 KB | Output is correct |
32 | Correct | 2 ms | 340 KB | Output is correct |
33 | Correct | 4 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 | 212 KB | Output is correct |
37 | Correct | 0 ms | 212 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 | 308 KB | Output is correct |
41 | Correct | 4 ms | 452 KB | Output is correct |
42 | Correct | 6 ms | 468 KB | Output is correct |
43 | Correct | 1 ms | 316 KB | Output is correct |
44 | Correct | 34 ms | 1692 KB | Output is correct |
45 | Correct | 0 ms | 212 KB | Output is correct |
46 | Correct | 1 ms | 212 KB | Output is correct |
47 | Correct | 5 ms | 340 KB | Output is correct |
48 | Correct | 1 ms | 308 KB | Output is correct |
49 | Correct | 1 ms | 212 KB | Output is correct |
50 | Correct | 1 ms | 304 KB | Output is correct |
51 | Correct | 93 ms | 4324 KB | Output is correct |
52 | Correct | 72 ms | 2248 KB | Output is correct |
53 | Correct | 54 ms | 2272 KB | Output is correct |
54 | Correct | 61 ms | 1468 KB | Output is correct |
55 | Correct | 146 ms | 3944 KB | Output is correct |
56 | Correct | 23 ms | 1168 KB | Output is correct |
57 | Correct | 172 ms | 8320 KB | Output is correct |
58 | Correct | 189 ms | 8524 KB | Output is correct |
59 | Correct | 213 ms | 8440 KB | Output is correct |
60 | Correct | 241 ms | 8388 KB | Output is correct |
61 | Correct | 430 ms | 8432 KB | Output is correct |
62 | Correct | 265 ms | 3800 KB | Output is correct |
63 | Correct | 491 ms | 9096 KB | Output is correct |
64 | Correct | 271 ms | 3800 KB | Output is correct |
65 | Correct | 0 ms | 212 KB | Output is correct |
66 | Correct | 50 ms | 3796 KB | Output is correct |
67 | Correct | 163 ms | 9228 KB | Output is correct |
68 | Correct | 174 ms | 8400 KB | Output is correct |
69 | Correct | 46 ms | 1168 KB | Output is correct |
70 | Correct | 12 ms | 468 KB | Output is correct |
71 | Correct | 1 ms | 212 KB | Output is correct |
72 | Correct | 70 ms | 1364 KB | Output is correct |
73 | Correct | 14 ms | 536 KB | Output is correct |
74 | Correct | 2 ms | 340 KB | Output is correct |
75 | Correct | 196 ms | 8376 KB | Output is correct |
76 | Correct | 229 ms | 8396 KB | Output is correct |
77 | Correct | 250 ms | 8444 KB | Output is correct |
78 | Correct | 332 ms | 8484 KB | Output is correct |
79 | Correct | 462 ms | 8588 KB | Output is correct |
80 | Correct | 482 ms | 8452 KB | Output is correct |
81 | Correct | 635 ms | 6432 KB | Output is correct |
82 | Correct | 601 ms | 6452 KB | Output is correct |