# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1083914 | 2024-09-04T14:07:24 Z | vjudge1 | Rabbit Carrot (LMIO19_triusis) | C++14 | 198 ms | 216768 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]; 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++) { int sw = 0; 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 (sw == 0) { box[i].push_back({z.fi, a[i]}); sw = 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 | 1 ms | 4956 KB | Output is correct |
2 | Correct | 1 ms | 5168 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 | 2 ms | 4952 KB | Output is correct |
11 | Correct | 1 ms | 4956 KB | Output is correct |
12 | Correct | 1 ms | 5160 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 | 1 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 | 5168 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 | 2 ms | 4952 KB | Output is correct |
11 | Correct | 1 ms | 4956 KB | Output is correct |
12 | Correct | 1 ms | 5160 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 | 1 ms | 4956 KB | Output is correct |
17 | Correct | 2 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 | Correct | 131 ms | 147028 KB | Output is correct |
21 | Correct | 188 ms | 216660 KB | Output is correct |
22 | Correct | 2 ms | 5460 KB | Output is correct |
23 | Correct | 187 ms | 216544 KB | Output is correct |
24 | Correct | 180 ms | 216768 KB | Output is correct |
25 | Incorrect | 198 ms | 212052 KB | Output isn't correct |
26 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 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 | 131 ms | 147028 KB | Output is correct |
5 | Correct | 188 ms | 216660 KB | Output is correct |
6 | Correct | 2 ms | 5460 KB | Output is correct |
7 | Correct | 187 ms | 216544 KB | Output is correct |
8 | Correct | 180 ms | 216768 KB | Output is correct |
9 | Incorrect | 198 ms | 212052 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 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 | 131 ms | 147028 KB | Output is correct |
5 | Correct | 188 ms | 216660 KB | Output is correct |
6 | Correct | 2 ms | 5460 KB | Output is correct |
7 | Correct | 187 ms | 216544 KB | Output is correct |
8 | Correct | 180 ms | 216768 KB | Output is correct |
9 | Incorrect | 198 ms | 212052 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |