# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1103493 | overwatch9 | Telefoni (COCI17_telefoni) | C++17 | 46 ms | 3380 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, d;
cin >> n >> d;
vector <int> nums(n);
for (int i = 0; i < n; i++)
cin >> nums[i];
vector <int> dp(n);
dp[0] = 0;
multiset <int> s;
s.insert(0);
for (int i = 1; i < n; i++) {
dp[i] = *s.begin();
if (nums[i] == 0)
dp[i]++;
s.insert(dp[i]);
if (i >= d)
s.erase(s.find(dp[i-d]));
}
cout << dp[n-1] << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |