# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
642156 | 2022-09-18T15:10:30 Z | Baytoro | Self Study (JOI22_ho_t2) | C++17 | 216 ms | 10808 KB |
#include <bits/stdc++.h> using namespace std; //#ifndef EVAL //#include "grader.h" //#endif #define Baytoro_MayrambekovOrz void solve() #define ios ios::sync_with_stdio(false); cin.tie(NULL); #define pb push_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fr first #define sc second #define int long long #define endl '\n' #define yes cout<<"YES\n"; #define no cout<<"NO\n"; void fopn(string name){ freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout); } int binpow(int a,int n){ if(n==0) return 1; if(n%2==1) return binpow(a, n-1)*a; else{ int b=binpow(a, n/2); return b*b; } } int c,n,s,m,i,j,k,x,y,cnt=0,sum=0,res=0; Baytoro_MayrambekovOrz{ cin>>n>>m; vector<int> a(n),b(n); for(i=0;i<n;i++) cin>>a[i]; for(i=0;i<n;i++) cin>>b[i]; int l=0,r=2e18; while(r-l>1){ int md=(l+r)/2; cnt=n*m; for(i=0;i<n;i++){ if(a[i]>=b[i]){ if(a[i]*m>=md) cnt-=(md+a[i]-1)/a[i]; else cnt-=m+(md-a[i]*m+b[i]-1)/b[i]; } else cnt-=(md+b[i]-1)/b[i]; if(cnt<0){ r=md; break; } } if(cnt>=0) l=md; } cout<<l<<endl; } main(){ ios; int T=1; //cin>>T; while(T--){ solve(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 316 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 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 | 2 ms | 468 KB | Output is correct |
11 | Correct | 98 ms | 5532 KB | Output is correct |
12 | Correct | 100 ms | 5452 KB | Output is correct |
13 | Correct | 81 ms | 5516 KB | Output is correct |
14 | Correct | 70 ms | 5532 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 30 ms | 5472 KB | Output is correct |
17 | Correct | 106 ms | 5536 KB | Output is correct |
18 | Correct | 91 ms | 5516 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 30 ms | 5472 KB | Output is correct |
3 | Correct | 106 ms | 5536 KB | Output is correct |
4 | Correct | 91 ms | 5516 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 320 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 49 ms | 3176 KB | Output is correct |
14 | Correct | 37 ms | 2512 KB | Output is correct |
15 | Correct | 28 ms | 2016 KB | Output is correct |
16 | Correct | 21 ms | 1740 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 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 | 1 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 2 ms | 468 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 | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 316 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 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 | 2 ms | 468 KB | Output is correct |
11 | Correct | 98 ms | 5532 KB | Output is correct |
12 | Correct | 100 ms | 5452 KB | Output is correct |
13 | Correct | 81 ms | 5516 KB | Output is correct |
14 | Correct | 70 ms | 5532 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 320 KB | Output is correct |
19 | Correct | 1 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 | 1 ms | 212 KB | Output is correct |
23 | Correct | 49 ms | 3176 KB | Output is correct |
24 | Correct | 37 ms | 2512 KB | Output is correct |
25 | Correct | 28 ms | 2016 KB | Output is correct |
26 | Correct | 21 ms | 1740 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 1 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 | 1 ms | 212 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 2 ms | 468 KB | Output is correct |
34 | Correct | 0 ms | 212 KB | Output is correct |
35 | Correct | 30 ms | 5472 KB | Output is correct |
36 | Correct | 106 ms | 5536 KB | Output is correct |
37 | Correct | 91 ms | 5516 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 | 320 KB | Output is correct |
41 | Correct | 1 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 | 212 KB | Output is correct |
45 | Correct | 2 ms | 468 KB | Output is correct |
46 | Correct | 4 ms | 596 KB | Output is correct |
47 | Correct | 1 ms | 340 KB | Output is correct |
48 | Correct | 20 ms | 1720 KB | Output is correct |
49 | Correct | 1 ms | 212 KB | Output is correct |
50 | Correct | 1 ms | 212 KB | Output is correct |
51 | Correct | 2 ms | 468 KB | Output is correct |
52 | Correct | 1 ms | 212 KB | Output is correct |
53 | Correct | 1 ms | 212 KB | Output is correct |
54 | Correct | 1 ms | 316 KB | Output is correct |
55 | Correct | 52 ms | 3160 KB | Output is correct |
56 | Correct | 34 ms | 2380 KB | Output is correct |
57 | Correct | 29 ms | 2312 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 | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 320 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 49 ms | 3176 KB | Output is correct |
10 | Correct | 37 ms | 2512 KB | Output is correct |
11 | Correct | 28 ms | 2016 KB | Output is correct |
12 | Correct | 21 ms | 1740 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 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 | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 2 ms | 468 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 30 ms | 5472 KB | Output is correct |
22 | Correct | 106 ms | 5536 KB | Output is correct |
23 | Correct | 91 ms | 5516 KB | Output is correct |
24 | Correct | 30 ms | 1540 KB | Output is correct |
25 | Correct | 68 ms | 2936 KB | Output is correct |
26 | Correct | 13 ms | 1256 KB | Output is correct |
27 | Correct | 96 ms | 5452 KB | Output is correct |
28 | Correct | 100 ms | 5524 KB | Output is correct |
29 | Correct | 99 ms | 5516 KB | Output is correct |
30 | Correct | 119 ms | 5512 KB | Output is correct |
31 | Correct | 199 ms | 5568 KB | Output is correct |
32 | Correct | 106 ms | 5480 KB | Output is correct |
33 | Correct | 171 ms | 5460 KB | Output is correct |
34 | Correct | 100 ms | 6184 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 | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 316 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 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 | 2 ms | 468 KB | Output is correct |
11 | Correct | 98 ms | 5532 KB | Output is correct |
12 | Correct | 100 ms | 5452 KB | Output is correct |
13 | Correct | 81 ms | 5516 KB | Output is correct |
14 | Correct | 70 ms | 5532 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 320 KB | Output is correct |
19 | Correct | 1 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 | 1 ms | 212 KB | Output is correct |
23 | Correct | 49 ms | 3176 KB | Output is correct |
24 | Correct | 37 ms | 2512 KB | Output is correct |
25 | Correct | 28 ms | 2016 KB | Output is correct |
26 | Correct | 21 ms | 1740 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 1 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 | 1 ms | 212 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 2 ms | 468 KB | Output is correct |
34 | Correct | 1 ms | 212 KB | Output is correct |
35 | Correct | 0 ms | 212 KB | Output is correct |
36 | Correct | 1 ms | 320 KB | Output is correct |
37 | Correct | 1 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 | 212 KB | Output is correct |
41 | Correct | 2 ms | 468 KB | Output is correct |
42 | Correct | 4 ms | 596 KB | Output is correct |
43 | Correct | 1 ms | 340 KB | Output is correct |
44 | Correct | 20 ms | 1720 KB | Output is correct |
45 | Correct | 1 ms | 212 KB | Output is correct |
46 | Correct | 1 ms | 212 KB | Output is correct |
47 | Correct | 2 ms | 468 KB | Output is correct |
48 | Correct | 1 ms | 212 KB | Output is correct |
49 | Correct | 1 ms | 212 KB | Output is correct |
50 | Correct | 1 ms | 316 KB | Output is correct |
51 | Correct | 52 ms | 3160 KB | Output is correct |
52 | Correct | 34 ms | 2380 KB | Output is correct |
53 | Correct | 29 ms | 2312 KB | Output is correct |
54 | Correct | 30 ms | 1540 KB | Output is correct |
55 | Correct | 68 ms | 2936 KB | Output is correct |
56 | Correct | 13 ms | 1256 KB | Output is correct |
57 | Correct | 96 ms | 5452 KB | Output is correct |
58 | Correct | 100 ms | 5524 KB | Output is correct |
59 | Correct | 99 ms | 5516 KB | Output is correct |
60 | Correct | 119 ms | 5512 KB | Output is correct |
61 | Correct | 199 ms | 5568 KB | Output is correct |
62 | Correct | 106 ms | 5480 KB | Output is correct |
63 | Correct | 171 ms | 5460 KB | Output is correct |
64 | Correct | 100 ms | 6184 KB | Output is correct |
65 | Correct | 0 ms | 212 KB | Output is correct |
66 | Correct | 30 ms | 5472 KB | Output is correct |
67 | Correct | 106 ms | 5536 KB | Output is correct |
68 | Correct | 91 ms | 5516 KB | Output is correct |
69 | Correct | 21 ms | 1364 KB | Output is correct |
70 | Correct | 6 ms | 596 KB | Output is correct |
71 | Correct | 1 ms | 212 KB | Output is correct |
72 | Correct | 31 ms | 1740 KB | Output is correct |
73 | Correct | 7 ms | 640 KB | Output is correct |
74 | Correct | 1 ms | 328 KB | Output is correct |
75 | Correct | 114 ms | 10688 KB | Output is correct |
76 | Correct | 117 ms | 10804 KB | Output is correct |
77 | Correct | 120 ms | 10808 KB | Output is correct |
78 | Correct | 154 ms | 10760 KB | Output is correct |
79 | Correct | 214 ms | 10748 KB | Output is correct |
80 | Correct | 213 ms | 10760 KB | Output is correct |
81 | Correct | 216 ms | 8824 KB | Output is correct |
82 | Correct | 117 ms | 8704 KB | Output is correct |