Submission #211466

#TimeUsernameProblemLanguageResultExecution timeMemory
211466jzhTelefoni (COCI17_telefoni)C++14
80 / 80
21 ms2688 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ll n,k,i,sum=0,x,ans=0; cin>>n>>k; ll arr[n]; for (i=0;i<n;i++){ cin>>arr[i]; x=arr[i]; sum+=x; if (i>=k){ sum-=arr[i-k]; } if (i>=k-1){ if (sum==0){ ans++; arr[i]=1; sum++; } } } cout<<ans<<'\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...