# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
592920 | 2022-07-09T20:04:16 Z | Luxry | Distributing Candies (IOI21_candies) | C++17 | 5000 ms | 13272 KB |
#include <iostream> #include <vector> #include <cmath> using namespace std; vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) { vector<int> s(c.size()); for (int j = 0; j < v.size(); ++j) { if (v[j] > 0) { for (int k = l[j]; k <= r[j]; ++k) { s[k] = min(c[k], s[k] + v[j]); } } else if (v[j] < 0) { for (int k = l[j]; k <= r[j]; ++k) { s[k] = max(0, s[k] + v[j]); } } } return s; } int solve() { int n; cin >> n; vector<int> c(n); for (int i = 0; i < n; ++i) { cin >> c[i]; } int q; cin >> q; vector<int> l(q), r(q), v(q); for (int i = 0; i < q; ++i) { cin >> l[i], r[i], v[i]; } vector<int> result = distribute_candies(c, l, r, v); for (int i = 0; i < n; ++i) { cout << result[i] << " "; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 3 ms | 312 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 5025 ms | 12196 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 164 ms | 8028 KB | Output is correct |
3 | Correct | 160 ms | 5900 KB | Output is correct |
4 | Execution timed out | 5040 ms | 13272 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 428 ms | 7656 KB | Output is correct |
4 | Correct | 400 ms | 3932 KB | Output is correct |
5 | Execution timed out | 5065 ms | 10832 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 3 ms | 312 KB | Output is correct |
6 | Execution timed out | 5025 ms | 12196 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |