# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
791719 | 2023-07-24T09:03:12 Z | shoryu386 | Telefoni (COCI17_telefoni) | C++17 | 40 ms | 3212 KB |
#include <bits/stdc++.h> using namespace std; #define int long long main(){ int n, d; cin >> n >> d; int cringe[n]; for (int x = 0; x < n; x++) cin >> cringe[x]; int lastOne = 0; int ans = 0; for (int x = 0; x < n; x++){ if (cringe[x] == 1) lastOne = x; if (x - lastOne >= d) ans++, lastOne = x; } cout << ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 328 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 300 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 40 ms | 3212 KB | Output is correct |
9 | Correct | 36 ms | 3212 KB | Output is correct |
10 | Correct | 34 ms | 3136 KB | Output is correct |