Submission #440509

#TimeUsernameProblemLanguageResultExecution timeMemory
440509MetalPowerDistributing Candies (IOI21_candies)C++17
3 / 100
5094 ms13252 KiB
#include <bits/stdc++.h> using namespace std; #include "candies.h" vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v){ int N = c.size(), Q = v.size(); vector<int> ans(N, 0); for(int i = 0; i < Q; i++){ for(int j = l[i]; j <= r[i]; j++){ if(v[i] < 0) ans[j] = max(0, ans[j] + v[i]); else if(v[i] > 0) ans[j] = min(c[j], ans[j] + v[i]); } } return ans; }
#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...