# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
638703 | 2022-09-07T04:19:41 Z | jamezzz | Self Study (JOI22_ho_t2) | C++17 | 470 ms | 8644 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; while(lo<=hi){ mid=(lo+hi)>>1; ll rem=(ll)n*m; for(int i=0;i<n;++i){ if(a[i]>b[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); rem-=take+self; } else{ ll self=(mid+b[i]-1)/b[i]; rem-=self; } } if(rem>=0){ res=mid; lo=mid+1; } else hi=mid-1; } pf("%lld\n",res); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 308 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 | 1 ms | 212 KB | Output is correct |
10 | Correct | 4 ms | 316 KB | Output is correct |
11 | Correct | 230 ms | 8424 KB | Output is correct |
12 | Correct | 229 ms | 8644 KB | Output is correct |
13 | Correct | 154 ms | 6348 KB | Output is correct |
14 | Incorrect | 470 ms | 6556 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 | 300 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 | 1 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 88 ms | 4376 KB | Output is correct |
10 | Correct | 57 ms | 3008 KB | Output is correct |
11 | Correct | 43 ms | 2344 KB | Output is correct |
12 | Correct | 36 ms | 1864 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 | 1 ms | 312 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Incorrect | 6 ms | 348 KB | Output isn't correct |
19 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 308 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 | 1 ms | 212 KB | Output is correct |
10 | Correct | 4 ms | 316 KB | Output is correct |
11 | Correct | 230 ms | 8424 KB | Output is correct |
12 | Correct | 229 ms | 8644 KB | Output is correct |
13 | Correct | 154 ms | 6348 KB | Output is correct |
14 | Incorrect | 470 ms | 6556 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 | 300 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 | 1 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 88 ms | 4376 KB | Output is correct |
10 | Correct | 57 ms | 3008 KB | Output is correct |
11 | Correct | 43 ms | 2344 KB | Output is correct |
12 | Correct | 36 ms | 1864 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 | 1 ms | 312 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Incorrect | 6 ms | 348 KB | Output isn't correct |
19 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 308 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 | 1 ms | 212 KB | Output is correct |
10 | Correct | 4 ms | 316 KB | Output is correct |
11 | Correct | 230 ms | 8424 KB | Output is correct |
12 | Correct | 229 ms | 8644 KB | Output is correct |
13 | Correct | 154 ms | 6348 KB | Output is correct |
14 | Incorrect | 470 ms | 6556 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |