# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1083924 | 2024-09-04T14:17:13 Z | nqknht | Rabbit Carrot (LMIO19_triusis) | C++14 | 225 ms | 262144 KB |
#include <bits/stdc++.h> #define ll long long #define fi first #define se second const ll I = 2e5 + 9; using namespace std; ll n, M, a[I]; vector<pair<ll, ll>> box[I]; bool mark[I]; int main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> M; for (int i = 1; i <= n; i++) cin >> a[i]; box[0].push_back({0, 0}); for (int i = 1; i <= n; i++) { for(int j = i - 1; j >= 0; j --) mark[j] = false; for (auto z : box[i - 1]) // first = cnt, second = ending { if (a[i] - z.se > M) box[i].push_back({z.fi + 1, z.se + M}); else if (a[i] - z.se <= M) { if (!mark[z.fi]) { box[i].push_back({z.fi, a[i]}); mark[z.fi] = 1; } if(a[i] - z.se != M) box[i].push_back({z.fi + 1, z.se + M}); } } } ll rs = 10000000; for(int i = 0; i < box[n].size(); i ++) rs = min(rs, box[n][i].fi); cout << rs; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 6492 KB | Output is correct |
2 | Correct | 1 ms | 6492 KB | Output is correct |
3 | Correct | 1 ms | 6492 KB | Output is correct |
4 | Correct | 1 ms | 6532 KB | Output is correct |
5 | Correct | 1 ms | 6492 KB | Output is correct |
6 | Correct | 1 ms | 6492 KB | Output is correct |
7 | Correct | 1 ms | 6492 KB | Output is correct |
8 | Correct | 1 ms | 6492 KB | Output is correct |
9 | Correct | 1 ms | 6492 KB | Output is correct |
10 | Correct | 1 ms | 6492 KB | Output is correct |
11 | Correct | 1 ms | 6492 KB | Output is correct |
12 | Correct | 1 ms | 6492 KB | Output is correct |
13 | Correct | 1 ms | 6492 KB | Output is correct |
14 | Correct | 1 ms | 6492 KB | Output is correct |
15 | Correct | 2 ms | 6492 KB | Output is correct |
16 | Correct | 1 ms | 6492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 6492 KB | Output is correct |
2 | Correct | 1 ms | 6492 KB | Output is correct |
3 | Correct | 1 ms | 6492 KB | Output is correct |
4 | Correct | 1 ms | 6532 KB | Output is correct |
5 | Correct | 1 ms | 6492 KB | Output is correct |
6 | Correct | 1 ms | 6492 KB | Output is correct |
7 | Correct | 1 ms | 6492 KB | Output is correct |
8 | Correct | 1 ms | 6492 KB | Output is correct |
9 | Correct | 1 ms | 6492 KB | Output is correct |
10 | Correct | 1 ms | 6492 KB | Output is correct |
11 | Correct | 1 ms | 6492 KB | Output is correct |
12 | Correct | 1 ms | 6492 KB | Output is correct |
13 | Correct | 1 ms | 6492 KB | Output is correct |
14 | Correct | 1 ms | 6492 KB | Output is correct |
15 | Correct | 2 ms | 6492 KB | Output is correct |
16 | Correct | 1 ms | 6492 KB | Output is correct |
17 | Correct | 1 ms | 6492 KB | Output is correct |
18 | Correct | 1 ms | 6492 KB | Output is correct |
19 | Correct | 1 ms | 6492 KB | Output is correct |
20 | Runtime error | 225 ms | 262144 KB | Execution killed with signal 9 |
21 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6492 KB | Output is correct |
2 | Correct | 1 ms | 6492 KB | Output is correct |
3 | Correct | 1 ms | 6492 KB | Output is correct |
4 | Runtime error | 225 ms | 262144 KB | Execution killed with signal 9 |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6492 KB | Output is correct |
2 | Correct | 1 ms | 6492 KB | Output is correct |
3 | Correct | 1 ms | 6492 KB | Output is correct |
4 | Runtime error | 225 ms | 262144 KB | Execution killed with signal 9 |
5 | Halted | 0 ms | 0 KB | - |