#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forr(i,a,b) for(int i=a;i>=b;i--)
#define F first
#define S second
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define INF (LL)(9e18)
#define int __int128_t
using namespace std;
using LL=long long;
using pii=pair<int,int>;
const int MAXN=300030;
int a[MAXN];
int b[MAXN];
bool check(int n,int m,int tar){
int s=0;
For(i,1,n){
s+=(tar+a[i]-1)/a[i];
}
return s<=n*m;
}
int32_t main(){
ios::sync_with_stdio(false);
cin.tie(0);
// OAO
LL n,m; cin>>n>>m;
For(i,1,n){
LL t; cin>>t;
a[i]=t;
}
int hi=1e18+10;
int lo=0;
while(hi-lo>1){
int mi=(hi+lo)/2;
if(check(n,m,mi)) lo=mi;
else hi=mi;
}
cout<<(LL)lo<<"\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
68 ms |
2616 KB |
Output is correct |
10 |
Correct |
47 ms |
1868 KB |
Output is correct |
11 |
Correct |
35 ms |
1492 KB |
Output is correct |
12 |
Correct |
30 ms |
1240 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
3 ms |
332 KB |
Output is correct |
19 |
Correct |
3 ms |
460 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
182 ms |
5040 KB |
Output is correct |
22 |
Correct |
150 ms |
5640 KB |
Output is correct |
23 |
Correct |
142 ms |
5776 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
68 ms |
2616 KB |
Output is correct |
10 |
Correct |
47 ms |
1868 KB |
Output is correct |
11 |
Correct |
35 ms |
1492 KB |
Output is correct |
12 |
Correct |
30 ms |
1240 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
3 ms |
332 KB |
Output is correct |
19 |
Correct |
3 ms |
460 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
182 ms |
5040 KB |
Output is correct |
22 |
Correct |
150 ms |
5640 KB |
Output is correct |
23 |
Correct |
142 ms |
5776 KB |
Output is correct |
24 |
Correct |
29 ms |
1228 KB |
Output is correct |
25 |
Correct |
75 ms |
3396 KB |
Output is correct |
26 |
Correct |
18 ms |
964 KB |
Output is correct |
27 |
Correct |
142 ms |
6572 KB |
Output is correct |
28 |
Correct |
139 ms |
6456 KB |
Output is correct |
29 |
Correct |
147 ms |
6464 KB |
Output is correct |
30 |
Correct |
153 ms |
6540 KB |
Output is correct |
31 |
Correct |
194 ms |
6556 KB |
Output is correct |
32 |
Correct |
215 ms |
5276 KB |
Output is correct |
33 |
Incorrect |
217 ms |
6544 KB |
Output isn't correct |
34 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |