# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49827 | A_H_Ghaznavi | Rasvjeta (COCI17_rasvjeta) | C++14 | 4 ms | 692 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.
// In the name of god
// A.H.Ghaznavi
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m,k,lig[1010],x[1010],r,ans;
bool ligtf[1010];
int nomore(int z)
{
if (z<=n)
return z;
else
return n;
}
int no0(int z)
{
if (z>=1)
return z;
else
return 1;
}
int sagf (int z,int y)
{
if (z%y==0)
return z/y;
else
return z/y+1;
}
int main()
{
cin>>n>>m>>k;
for (int i=1;i<=m;i++)
{
cin>>lig[i];
for (int i2=no0(lig[i]-k);i2<=nomore(lig[i]+k);i2++)
ligtf[i2]=true;
}
for (int i=1;i<=n;i++)
{
if (!ligtf[i])
x[r]++;
else
r++;
}
for (int i=0;i<=r;i++)
ans+=sagf(x[i],k*2+1);
cout<<ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |