# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
165617 | itiam | Rasvjeta (COCI17_rasvjeta) | C++11 | 2 ms | 404 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
if (z<0) z=0;
if (z2>N) z2=N;
for (int j=z;j<z2;j++){
L[j]=1;
}
br+=1;
}
}
//for(int i=0; i<N;i++) cout << L[i] << " ";
//cout << "\n";
cout << br;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |