#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=1000000000000000010;
int lo=0;
while(hi-lo>1){
int mi=lo+(hi-lo)/2;
if(check(n,m,mi)) lo=mi;
else hi=mi;
}
cout<<(LL)lo<<"\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
68 ms |
2652 KB |
Output is correct |
10 |
Correct |
46 ms |
1868 KB |
Output is correct |
11 |
Correct |
35 ms |
1484 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 |
0 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 |
4 ms |
332 KB |
Output is correct |
19 |
Correct |
3 ms |
332 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
188 ms |
4992 KB |
Output is correct |
22 |
Correct |
142 ms |
4996 KB |
Output is correct |
23 |
Correct |
143 ms |
4996 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
68 ms |
2652 KB |
Output is correct |
10 |
Correct |
46 ms |
1868 KB |
Output is correct |
11 |
Correct |
35 ms |
1484 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 |
0 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 |
4 ms |
332 KB |
Output is correct |
19 |
Correct |
3 ms |
332 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Correct |
188 ms |
4992 KB |
Output is correct |
22 |
Correct |
142 ms |
4996 KB |
Output is correct |
23 |
Correct |
143 ms |
4996 KB |
Output is correct |
24 |
Correct |
34 ms |
1092 KB |
Output is correct |
25 |
Correct |
79 ms |
2420 KB |
Output is correct |
26 |
Correct |
17 ms |
808 KB |
Output is correct |
27 |
Correct |
138 ms |
4872 KB |
Output is correct |
28 |
Correct |
150 ms |
4932 KB |
Output is correct |
29 |
Correct |
150 ms |
5000 KB |
Output is correct |
30 |
Correct |
157 ms |
5024 KB |
Output is correct |
31 |
Correct |
194 ms |
4940 KB |
Output is correct |
32 |
Correct |
221 ms |
4952 KB |
Output is correct |
33 |
Correct |
215 ms |
4996 KB |
Output is correct |
34 |
Correct |
206 ms |
5000 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |