Submission #66521

#TimeUsernameProblemLanguageResultExecution timeMemory
66521KLPPTelefoni (COCI17_telefoni)C++14
80 / 80
63 ms3640 KiB
#include<iostream> #include<vector> #include<queue> #include<algorithm> #include<stdio.h> using namespace std; int main(){ int n,d; cin>>n>>d; int arr[n]; for(int i=0;i<n;i++){ cin>>arr[i]; } int next=n-1; int cnt=0; for(int i=n-2;i>-1;i--){ if(arr[i]==1)next=i; else{ if(next-i>=d){ cnt++; next=i; } } }cout<<cnt<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...