답안 #538655

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
538655 2022-03-17T11:41:08 Z Benmath Self Study (JOI22_ho_t2) C++14
0 / 100
441 ms 4964 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;
long long int ans=0;

while(l<=r){
   long long int mid=l+(r-l)/2;

   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)){
      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 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 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 7 ms 340 KB Output is correct
11 Correct 335 ms 4948 KB Output is correct
12 Correct 349 ms 4964 KB Output is correct
13 Correct 289 ms 4964 KB Output is correct
14 Incorrect 441 ms 4964 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 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 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 172 ms 2620 KB Output is correct
10 Correct 117 ms 1840 KB Output is correct
11 Correct 86 ms 1484 KB Output is correct
12 Correct 66 ms 1208 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 1 ms 212 KB Output is correct
18 Incorrect 7 ms 340 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 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 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 7 ms 340 KB Output is correct
11 Correct 335 ms 4948 KB Output is correct
12 Correct 349 ms 4964 KB Output is correct
13 Correct 289 ms 4964 KB Output is correct
14 Incorrect 441 ms 4964 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 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 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 172 ms 2620 KB Output is correct
10 Correct 117 ms 1840 KB Output is correct
11 Correct 86 ms 1484 KB Output is correct
12 Correct 66 ms 1208 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 1 ms 212 KB Output is correct
18 Incorrect 7 ms 340 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 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 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 7 ms 340 KB Output is correct
11 Correct 335 ms 4948 KB Output is correct
12 Correct 349 ms 4964 KB Output is correct
13 Correct 289 ms 4964 KB Output is correct
14 Incorrect 441 ms 4964 KB Output isn't correct
15 Halted 0 ms 0 KB -