#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
const int mxn=1e6+5;
int n,m,d;
pair<int,int>a[mxn];
int main(){
cin>>n>>d>>m;
for(int i=1;i<=m;i++){
cin>>a[i].fr;
a[i].sc=i;
}
a[m+1].fr=1e9;
sort(a+1,a+m+1);
int l=0,r=m;
while(r-l>1){
//cout<<r<<" "<<l<<endl;
int mid=(l+r)/2,p=1;
for(int i=1;i<=n;i++){
if(a[p].fr+d<i){
break;
}
int cnt=0;
while(cnt<mid && a[p].fr<=i){
cnt++;
p++;
}
}
if(p>m){
r=mid;
}
else{
l=mid;
}
}
cout<<r<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
16 ms |
2908 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
15 ms |
2908 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
15 ms |
2760 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
17 ms |
2908 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
17 ms |
2944 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
18 ms |
2908 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
15 ms |
2908 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
16 ms |
2972 KB |
Unexpected end of file - int32 expected |
9 |
Incorrect |
24 ms |
2908 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
22 ms |
2908 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
24 ms |
3056 KB |
Unexpected end of file - int32 expected |
12 |
Incorrect |
51 ms |
3156 KB |
Unexpected end of file - int32 expected |
13 |
Incorrect |
72 ms |
5464 KB |
Unexpected end of file - int32 expected |
14 |
Incorrect |
115 ms |
5716 KB |
Unexpected end of file - int32 expected |
15 |
Incorrect |
118 ms |
5540 KB |
Unexpected end of file - int32 expected |
16 |
Incorrect |
163 ms |
8112 KB |
Unexpected end of file - int32 expected |
17 |
Incorrect |
190 ms |
8532 KB |
Unexpected end of file - int32 expected |
18 |
Incorrect |
198 ms |
8284 KB |
Unexpected end of file - int32 expected |
19 |
Incorrect |
257 ms |
9040 KB |
Unexpected end of file - int32 expected |
20 |
Incorrect |
192 ms |
8504 KB |
Unexpected end of file - int32 expected |