Submission #1062728

#TimeUsernameProblemLanguageResultExecution timeMemory
1062728fv3Distributing Candies (IOI21_candies)C++17
8 / 100
66 ms12884 KiB
#include "candies.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) { int N = c.size(); int Q = l.size(); vector<ll> ps(N+1); for (int q = 0; q < Q; q++) { ps[l[q]] += v[q]; ps[r[q]+1] -= v[q]; } vector<int> s(N); ll sum = 0; for (int i = 0; i < N; i++) { sum += ps[i]; s[i] = min((ll)c[i], sum); } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...