Submission #49827

#TimeUsernameProblemLanguageResultExecution timeMemory
49827A_H_GhaznaviRasvjeta (COCI17_rasvjeta)C++14
50 / 50
4 ms692 KiB
// 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 timeMemoryGrader output
Fetching results...