Submission #165618

#TimeUsernameProblemLanguageResultExecution timeMemory
165618itiamRasvjeta (COCI17_rasvjeta)C++11
50 / 50
2 ms376 KiB
#include <iostream> #include <algorithm> #include <cstdio> #include <string> using namespace std; int L[1003]; int main(){ int N,M,K,P,z,z2,br=0; cin >> N >> M >> K; //K+=1; for (int i=0;i<M;i++){ cin >> P; P-=1; z=P-K; z2=P+K+1; if (z<0) z=0; if (z2>N) z2=N; for (int j=z;j<z2;j++){ L[j]=1; } } //for(int i=0; i<N;i++) cout << L[i] << " "; //cout << "\n"; for (int i=0;i<N;i++){ if (L[i]==0){ P=i+K; z=P-K; z2=P+K+1; if (z<0) z=0; if (z2>N) z2=N; for (int j=z;j<z2;j++){ L[j]=1; } br+=1; /*cout << br << ": "; for(int i=0; i<N;i++) cout << L[i] << " "; cout << "\n";*/ } } //for(int i=0; i<N;i++) cout << L[i] << " "; //cout << "\n"; cout << br; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...