# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1051475 | 2024-08-10T07:18:02 Z | MarwenElarbi | Distributing Candies (IOI21_candies) | C++17 | 61 ms | 12884 KB |
#include <bits/stdc++.h> using namespace std; #include "candies.h" std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l, std::vector<int> r, std::vector<int> v) { int n = c.size(); vector<long long> pre(n+1,0); vector<int> ans(n); for (int i = 0; i < l.size(); ++i) { pre[l[i]]+=v[i]; pre[r[i]+1]-=v[i]; } for (int i = 0; i < n; ++i) { if(i) pre[i]+=pre[i-1]; ans[i]=min(1ll*c[i],pre[i]); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 54 ms | 8956 KB | Output is correct |
2 | Correct | 61 ms | 12884 KB | Output is correct |
3 | Correct | 53 ms | 12728 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |