제출 #98099

#제출 시각아이디문제언어결과실행 시간메모리
98099dalgerokRasvjeta (COCI17_rasvjeta)C++17
50 / 50
3 ms384 KiB
#include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n, m, k; cin >> n >> m >> k; int a[n + 5]; memset(a, 0, sizeof(a)); for(int i = 1; i <= m; i++){ int x; cin >> x; a[max(1, x - k)] += 1; a[min(n + 1, x + k + 1)] -= 1; } int cur = 0, ans = 0; for(int i = 1; i <= n; i++){ cur += a[i]; if(cur == 0){ ans += 1; cur += 1; a[min(n + 1, i + 2 * k + 1)] -= 1; } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...