| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1339360 | apelpisia | Telefoni (COCI17_telefoni) | C++20 | 10 ms | 716 KiB |
#include <bits/stdc++.h>
using namespace std;
const int nx = 3e5+5;
int n, d, cnt = 0, l, r, ts=0;
bool phone[nx];
int main(){
cin.tie(NULL)->sync_with_stdio(false);
cin >> n >> d;
for(int i=0; i<n; i++){
cin >> phone[i];
}
l=0; r=l+d-1;
for(int i=0; i<=r; i++) ts+=phone[i];
while(r<n){
if(ts==0){
phone[r] = true;
cnt++;
ts++;
}
ts-=phone[l++];
ts+=phone[++r];
}
cout << cnt;
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
