| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 672806 | vjudge1 | The short shank; Redemption (BOI21_prison) | C++11 | 87 ms | 23092 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.
/*#pragma GCC optimize ("O3")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")*/
#include <bits/stdc++.h>
#include <set>
#include <map>
using namespace std;
#define ll long long
#define N (ll)((ll)2e6+5)
#define M ((ll)998244353)
#define fi first
#define se second
#define bs 2097151ll
ll n, t, m, l[N], a[N];
vector<pair<ll, ll>> v;
vector<ll> u;
inline bool cmp(ll x, ll y) { return x > y; }
int32_t main() {
#define int ll
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin >> n >> m >> t; v = { {0, n + 1} };
for (int i = 1; i <= n; i++) {
cin >> l[i], l[i] = min(n, max(i - 1, i + t - l[i]));
v.push_back({ i, l[i] });
while (v.back().second < i) v.pop_back();
if(l[i] < i) a[v.back().fi]++;
}
for (int i = 1; i <= n; i++) u.push_back(a[i]); sort(u.begin(), u.end(), cmp);
for (int i = 0; i < m; i++) n -= u[i]; cout << n;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
