# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1083926 | 2024-09-04T14:18:43 Z | nqknht | Rabbit Carrot (LMIO19_triusis) | C++14 | 346 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; int n, M, a[I]; vector<pair<int, int>> 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}); } } } int 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 | 1 ms | 4956 KB | Output is correct |
2 | Correct | 1 ms | 4956 KB | Output is correct |
3 | Correct | 1 ms | 4956 KB | Output is correct |
4 | Correct | 1 ms | 4956 KB | Output is correct |
5 | Correct | 1 ms | 4956 KB | Output is correct |
6 | Correct | 1 ms | 4956 KB | Output is correct |
7 | Correct | 1 ms | 4956 KB | Output is correct |
8 | Correct | 1 ms | 4956 KB | Output is correct |
9 | Correct | 1 ms | 4956 KB | Output is correct |
10 | Correct | 1 ms | 5048 KB | Output is correct |
11 | Correct | 1 ms | 4952 KB | Output is correct |
12 | Correct | 2 ms | 4956 KB | Output is correct |
13 | Correct | 1 ms | 4956 KB | Output is correct |
14 | Correct | 1 ms | 4956 KB | Output is correct |
15 | Correct | 1 ms | 4956 KB | Output is correct |
16 | Correct | 2 ms | 4956 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4956 KB | Output is correct |
2 | Correct | 1 ms | 4956 KB | Output is correct |
3 | Correct | 1 ms | 4956 KB | Output is correct |
4 | Correct | 1 ms | 4956 KB | Output is correct |
5 | Correct | 1 ms | 4956 KB | Output is correct |
6 | Correct | 1 ms | 4956 KB | Output is correct |
7 | Correct | 1 ms | 4956 KB | Output is correct |
8 | Correct | 1 ms | 4956 KB | Output is correct |
9 | Correct | 1 ms | 4956 KB | Output is correct |
10 | Correct | 1 ms | 5048 KB | Output is correct |
11 | Correct | 1 ms | 4952 KB | Output is correct |
12 | Correct | 2 ms | 4956 KB | Output is correct |
13 | Correct | 1 ms | 4956 KB | Output is correct |
14 | Correct | 1 ms | 4956 KB | Output is correct |
15 | Correct | 1 ms | 4956 KB | Output is correct |
16 | Correct | 2 ms | 4956 KB | Output is correct |
17 | Correct | 1 ms | 4956 KB | Output is correct |
18 | Correct | 1 ms | 4956 KB | Output is correct |
19 | Correct | 1 ms | 4956 KB | Output is correct |
20 | Runtime error | 346 ms | 262144 KB | Execution killed with signal 9 |
21 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4956 KB | Output is correct |
2 | Correct | 1 ms | 4956 KB | Output is correct |
3 | Correct | 1 ms | 4956 KB | Output is correct |
4 | Runtime error | 346 ms | 262144 KB | Execution killed with signal 9 |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4956 KB | Output is correct |
2 | Correct | 1 ms | 4956 KB | Output is correct |
3 | Correct | 1 ms | 4956 KB | Output is correct |
4 | Runtime error | 346 ms | 262144 KB | Execution killed with signal 9 |
5 | Halted | 0 ms | 0 KB | - |