#include<bits/stdc++.h>
using namespace std;
#define itn long long
#define ff first
#define ss second
#define int long long
#define pb push_back
vector<pair<int,int>>v;
int n,d,m;
bool check(int mid){
int j=0;
for(int i=1;i<=n;i++){
int p=mid;
while(j<m and p>0){
if(v[j].ff > i+d)break;
j++;
p--;
}
}
return j==m;
}
signed main(){
cin>>n>>d>>m;
for(int i=1;i<=m;i++){
int x;
cin>>x;
v.pb({x,i});
}
sort(v.begin(),v.end());
int lo=0,hi=1e16;
while(hi>=lo){
int mid=(hi+lo)/2;
bool u=check(mid);
if(u){
hi=mid-1;
}
else{
lo=mid+1;
}
}
cout<<lo+2<<endl;
for(int i=1;i<=n;i++)cout<<0<<endl;
}
/*
8 2 12
1 2 4 2 1 3 5 6 2 3 6 4
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
32 ms |
3524 KB |
Output isn't correct |
2 |
Incorrect |
32 ms |
3692 KB |
Output isn't correct |
3 |
Incorrect |
33 ms |
3536 KB |
Output isn't correct |
4 |
Incorrect |
33 ms |
2500 KB |
Output isn't correct |
5 |
Incorrect |
32 ms |
2500 KB |
Output isn't correct |
6 |
Incorrect |
33 ms |
2488 KB |
Output isn't correct |
7 |
Incorrect |
34 ms |
2716 KB |
Output isn't correct |
8 |
Incorrect |
35 ms |
2672 KB |
Output isn't correct |
9 |
Incorrect |
165 ms |
2500 KB |
Output isn't correct |
10 |
Incorrect |
167 ms |
2500 KB |
Output isn't correct |
11 |
Incorrect |
30 ms |
2500 KB |
Output isn't correct |
12 |
Incorrect |
55 ms |
4540 KB |
Output isn't correct |
13 |
Incorrect |
86 ms |
8604 KB |
Output isn't correct |
14 |
Incorrect |
129 ms |
8628 KB |
Output isn't correct |
15 |
Incorrect |
146 ms |
8780 KB |
Output isn't correct |
16 |
Incorrect |
197 ms |
16796 KB |
Output isn't correct |
17 |
Incorrect |
223 ms |
16932 KB |
Output isn't correct |
18 |
Incorrect |
267 ms |
16804 KB |
Output isn't correct |
19 |
Incorrect |
386 ms |
16796 KB |
Output isn't correct |
20 |
Incorrect |
221 ms |
16932 KB |
Output isn't correct |