Submission #435164

#TimeUsernameProblemLanguageResultExecution timeMemory
435164MinhQNgoDistributing Candies (IOI21_candies)C++17
3 / 100
5053 ms7364 KiB
#include "candies.h" #include <bits/stdc++.h> using namespace std; 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(); int q = l.size(); std::vector<int> s(n, 0); for (int time = 0; time < q; time++) { int L = l[time], R = r[time], V = v[time]; for (int i = L; i <= R; i++) { if (V > 0) s[i] = min(c[i], s[i] + V); else s[i] = max(0, s[i] + V); } } 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...