# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
979328 | Isam | Distributing Candies (IOI21_candies) | C++17 | 5059 ms | 7252 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "candies.h"
#include<bits/stdc++.h>
using namespace std;
constexpr int sz = 2e5 + 5;
int n, Q;
vector<int> a;
std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l, std::vector<int> r, std::vector<int> v){
n = (int)c.size(), Q = (int)r.size();
a.assign(n, 0);
for(register int q = 0; q < Q; ++q){
for(register int i = l[q]; i <= r[q]; ++i){
if(v[q] > 0){
a[i-1] = min(c[i-1], a[i-1] + v[q]);
}else{
a[i-1] = max(0, a[i-1] + v[q]);
}
}
}
return a;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |