#include<bits/stdc++.h>
using namespace std;
const int MAX=1010;
int n,m,k,x,s,sol;
int r[MAX];
int main(){
cin>>n>>m>>k;
for(int i=0;i<m;i++){
cin>>x;x--;
r[max(0,x-k)]++;
r[min(n,x+k+1)]--;
}
for(int i=0;i<n;i++){
s+=r[i];
if(!s){
sol++;
s++;
r[i+2*k+1]--;
}
}
cout<<sol;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
424 KB |
Output is correct |
5 |
Correct |
2 ms |
424 KB |
Output is correct |
6 |
Correct |
2 ms |
424 KB |
Output is correct |
7 |
Correct |
2 ms |
436 KB |
Output is correct |
8 |
Correct |
2 ms |
528 KB |
Output is correct |
9 |
Correct |
2 ms |
640 KB |
Output is correct |
10 |
Correct |
3 ms |
640 KB |
Output is correct |