제출 #98098

#제출 시각아이디문제언어결과실행 시간메모리
98098dalgerokRasvjeta (COCI17_rasvjeta)C++17
40 / 50
4 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 + 1]; memset(a, 0, sizeof(a)); for(int i = 1; i <= m; i++){ int x; cin >> x; a[max(0, x - k)] += 1; a[min(n, x + k + 1)] -= 1; } int cur = 0, ans = 0; for(int i = 0; i < n; i++){ cur += a[i]; if(cur == 0){ ans += 1; cur += 1; a[min(n, i + 2 * k + 1)] -= 1; } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...