답안 #538659

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
538659 2022-03-17T11:53:34 Z Benmath Self Study (JOI22_ho_t2) C++14
100 / 100
401 ms 10852 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
 
long long int n;
long long int m;
cin>>n>>m;
long long int a[n];
long long int b[n];
for(int i=0;i<n;i++){
   cin>>a[i];
}
for(int i=0;i<n;i++){
   
   cin>>b[i];

}
for(int i=0;i<n;i++){
   a[i]=max(a[i],b[i]);

}
long long int l=1;
long long int r=1e18;
r=r*8;
long long int ans=0;

while(l<=r){
   long long int mid=l+(r-l)/2;
int t1=0;
   long long int brojac=0;
   for(int i=0;i<n;i++){
      long long int ro=m*a[i];
      if(ro>=mid){
         brojac=brojac+mid/a[i];
         if(mid%a[i]!=0){
            brojac++;
         }
      }else{
         brojac=brojac+m;
         long long int mid1=mid-ro;
        
         
         brojac=brojac+mid1/b[i];
         
         if(mid1%b[i]!=0){
            brojac++;
         }
         
      }
      if(brojac>(n*m)){
         t1++;
         brojac=0;
      }
   }
   if(t1==0){
      ans=max(ans,mid);
      l=mid+1;
   }else{
      r=mid-1;
   }
}

cout<<ans<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 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 1 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 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 6 ms 340 KB Output is correct
11 Correct 335 ms 4964 KB Output is correct
12 Correct 328 ms 4968 KB Output is correct
13 Correct 265 ms 4948 KB Output is correct
14 Correct 324 ms 4964 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 257 ms 6140 KB Output is correct
17 Correct 354 ms 10852 KB Output is correct
18 Correct 337 ms 10708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 257 ms 6140 KB Output is correct
3 Correct 354 ms 10852 KB Output is correct
4 Correct 337 ms 10708 KB Output is correct
5 Correct 0 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 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 169 ms 2620 KB Output is correct
14 Correct 113 ms 1836 KB Output is correct
15 Correct 94 ms 1448 KB Output is correct
16 Correct 67 ms 1108 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 4 ms 284 KB Output is correct
23 Correct 6 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 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 1 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 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 6 ms 340 KB Output is correct
11 Correct 335 ms 4964 KB Output is correct
12 Correct 328 ms 4968 KB Output is correct
13 Correct 265 ms 4948 KB Output is correct
14 Correct 324 ms 4964 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 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 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 169 ms 2620 KB Output is correct
24 Correct 113 ms 1836 KB Output is correct
25 Correct 94 ms 1448 KB Output is correct
26 Correct 67 ms 1108 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 4 ms 284 KB Output is correct
33 Correct 6 ms 468 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 257 ms 6140 KB Output is correct
36 Correct 354 ms 10852 KB Output is correct
37 Correct 337 ms 10708 KB Output is correct
38 Correct 1 ms 296 KB Output is correct
39 Correct 0 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 296 KB Output is correct
42 Correct 1 ms 300 KB Output is correct
43 Correct 0 ms 212 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 7 ms 440 KB Output is correct
46 Correct 12 ms 724 KB Output is correct
47 Correct 2 ms 324 KB Output is correct
48 Correct 62 ms 2068 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 6 ms 444 KB Output is correct
52 Correct 0 ms 212 KB Output is correct
53 Correct 1 ms 304 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 168 ms 5412 KB Output is correct
56 Correct 98 ms 3084 KB Output is correct
57 Correct 118 ms 3156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 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 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 169 ms 2620 KB Output is correct
10 Correct 113 ms 1836 KB Output is correct
11 Correct 94 ms 1448 KB Output is correct
12 Correct 67 ms 1108 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 4 ms 284 KB Output is correct
19 Correct 6 ms 468 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 257 ms 6140 KB Output is correct
22 Correct 354 ms 10852 KB Output is correct
23 Correct 337 ms 10708 KB Output is correct
24 Correct 61 ms 1868 KB Output is correct
25 Correct 161 ms 4932 KB Output is correct
26 Correct 37 ms 1276 KB Output is correct
27 Correct 347 ms 10196 KB Output is correct
28 Correct 331 ms 10200 KB Output is correct
29 Correct 355 ms 10200 KB Output is correct
30 Correct 350 ms 10292 KB Output is correct
31 Correct 392 ms 10212 KB Output is correct
32 Correct 267 ms 6116 KB Output is correct
33 Correct 348 ms 10848 KB Output is correct
34 Correct 266 ms 6140 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 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 1 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 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 6 ms 340 KB Output is correct
11 Correct 335 ms 4964 KB Output is correct
12 Correct 328 ms 4968 KB Output is correct
13 Correct 265 ms 4948 KB Output is correct
14 Correct 324 ms 4964 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 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 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 169 ms 2620 KB Output is correct
24 Correct 113 ms 1836 KB Output is correct
25 Correct 94 ms 1448 KB Output is correct
26 Correct 67 ms 1108 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 4 ms 284 KB Output is correct
33 Correct 6 ms 468 KB Output is correct
34 Correct 1 ms 296 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 296 KB Output is correct
38 Correct 1 ms 300 KB Output is correct
39 Correct 0 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 7 ms 440 KB Output is correct
42 Correct 12 ms 724 KB Output is correct
43 Correct 2 ms 324 KB Output is correct
44 Correct 62 ms 2068 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 6 ms 444 KB Output is correct
48 Correct 0 ms 212 KB Output is correct
49 Correct 1 ms 304 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 168 ms 5412 KB Output is correct
52 Correct 98 ms 3084 KB Output is correct
53 Correct 118 ms 3156 KB Output is correct
54 Correct 61 ms 1868 KB Output is correct
55 Correct 161 ms 4932 KB Output is correct
56 Correct 37 ms 1276 KB Output is correct
57 Correct 347 ms 10196 KB Output is correct
58 Correct 331 ms 10200 KB Output is correct
59 Correct 355 ms 10200 KB Output is correct
60 Correct 350 ms 10292 KB Output is correct
61 Correct 392 ms 10212 KB Output is correct
62 Correct 267 ms 6116 KB Output is correct
63 Correct 348 ms 10848 KB Output is correct
64 Correct 266 ms 6140 KB Output is correct
65 Correct 1 ms 212 KB Output is correct
66 Correct 257 ms 6140 KB Output is correct
67 Correct 354 ms 10852 KB Output is correct
68 Correct 337 ms 10708 KB Output is correct
69 Correct 42 ms 1364 KB Output is correct
70 Correct 12 ms 572 KB Output is correct
71 Correct 1 ms 212 KB Output is correct
72 Correct 60 ms 1700 KB Output is correct
73 Correct 14 ms 640 KB Output is correct
74 Correct 2 ms 212 KB Output is correct
75 Correct 341 ms 10732 KB Output is correct
76 Correct 346 ms 10828 KB Output is correct
77 Correct 346 ms 10760 KB Output is correct
78 Correct 360 ms 10728 KB Output is correct
79 Correct 401 ms 10768 KB Output is correct
80 Correct 398 ms 10700 KB Output is correct
81 Correct 276 ms 8664 KB Output is correct
82 Correct 333 ms 8684 KB Output is correct