# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
638704 | 2022-09-07T04:22:45 Z | jamezzz | Self Study (JOI22_ho_t2) | C++17 | 711 ms | 2696 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=1,hi=1e18,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){ res=mid; lo=mid+1; } else hi=mid-1; } pf("%lld\n",res); }
Compilation message
# | Verdict | Execution time | Memory | 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 | 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 | 0 ms | 212 KB | Output is correct |
10 | Correct | 7 ms | 340 KB | Output is correct |
11 | Correct | 363 ms | 2696 KB | Output is correct |
12 | Correct | 366 ms | 2612 KB | Output is correct |
13 | Correct | 439 ms | 2544 KB | Output is correct |
14 | Incorrect | 711 ms | 2636 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | 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 | 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 | 187 ms | 1356 KB | Output is correct |
10 | Correct | 124 ms | 980 KB | Output is correct |
11 | Correct | 93 ms | 852 KB | Output is correct |
12 | Correct | 75 ms | 756 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 | Incorrect | 13 ms | 260 KB | Output isn't correct |
19 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | 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 | 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 | 0 ms | 212 KB | Output is correct |
10 | Correct | 7 ms | 340 KB | Output is correct |
11 | Correct | 363 ms | 2696 KB | Output is correct |
12 | Correct | 366 ms | 2612 KB | Output is correct |
13 | Correct | 439 ms | 2544 KB | Output is correct |
14 | Incorrect | 711 ms | 2636 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | 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 | 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 | 187 ms | 1356 KB | Output is correct |
10 | Correct | 124 ms | 980 KB | Output is correct |
11 | Correct | 93 ms | 852 KB | Output is correct |
12 | Correct | 75 ms | 756 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 | Incorrect | 13 ms | 260 KB | Output isn't correct |
19 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | 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 | 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 | 0 ms | 212 KB | Output is correct |
10 | Correct | 7 ms | 340 KB | Output is correct |
11 | Correct | 363 ms | 2696 KB | Output is correct |
12 | Correct | 366 ms | 2612 KB | Output is correct |
13 | Correct | 439 ms | 2544 KB | Output is correct |
14 | Incorrect | 711 ms | 2636 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |