#include <bits/stdc++.h>
using namespace std;
bitset<2001> bs;
int main()
{
int n; cin >> n;
int m; cin >> m;
int k; cin >> k;
vector<int> lights(m);
for(int i = 0; i < m; i++)
{
cin >> lights[i];
for(int j = max(lights[i]-k, 1); j <= min(lights[i]+k, n); j++){bs[j] = 1;}
}
int ans = 0;
for(int i = 1; i <= n; i++)
{
if(!bs[i])
{
ans++;
for(int j = max(i-k, 1); j <= min(i+k, n); j++){bs[j] = 1;}
}
}
cout << ans << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
216 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
296 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |