#include <bits/stdc++.h>
#pragma O3
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;
}
}
}
cout<<ans<<'\n';
}
Compilation message
telefoni.cpp:2:0: warning: ignoring #pragma O3 [-Wunknown-pragmas]
#pragma O3
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
512 KB |
Output isn't correct |
2 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
5 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
6 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
7 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
8 |
Incorrect |
20 ms |
3320 KB |
Output isn't correct |
9 |
Incorrect |
22 ms |
3328 KB |
Output isn't correct |
10 |
Incorrect |
22 ms |
3328 KB |
Output isn't correct |