# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
955032 | 2024-03-29T08:24:19 Z | sleepntsheep | Self Study (JOI22_ho_t2) | C | 1 ms | 2396 KB |
#include<stdio.h> long long max_(long long a,long long b){return a>b?a:b;} long long min_(long long a,long long b){return a<b?a:b;} #define N 300005 int n,m,a[N],b[N]; int ok(long long k) { static long long aa[N],bb[N]; for(int i=1;i<=n;++i) { aa[i]=min_((k+a[i]-1)/a[i],m); long long lf=max_(0,k-a[i]*aa[i]); bb[i]=(lf+b[i]-1)/b[i]; } long long free=0,take=0; for(int i=1;i<=n;++i)free+=m-aa[i]; for(int i=1;i<=n;++i) { take+=b[i]; if(take>free)return 0; } return 1; } int main() { scanf("%d%d",&n,&m); for(int i=1;i<=n;++i)scanf("%d",a+i); for(int i=1;i<=n;++i)scanf("%d",b+i),a[i]=max_(a[i],b[i]); long long lower=-1,upper=1e18+5; while(upper-lower>1) { long long mid=lower+(upper-lower)/2; if(ok(mid))lower=mid; else upper=mid; } printf("%lld",lower); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |