Submission #75824

#TimeUsernameProblemLanguageResultExecution timeMemory
75824charlies_mooTelefoni (COCI17_telefoni)C++98
80 / 80
66 ms3512 KiB
#include <cstdio> #include <iostream> #include <algorithm> using namespace std; int n,d,ans=0; int a[300001]; int main() { cin>>n>>d; for(int i=1;i<=n;i++) cin>>a[i]; int v=1; for(int i=1;i<=n;i++) { if(a[i]) v=i; else if(v+d==i) { v=i; ans++; } } cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...