Submission #85833

#TimeUsernameProblemLanguageResultExecution timeMemory
85833kraljlavova1Rasvjeta (COCI17_rasvjeta)C++11
50 / 50
3 ms640 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...