# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
979325 | Isam | Distributing Candies (IOI21_candies) | C++17 | 5062 ms | 12268 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;
vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, 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... |