Submission #1133714

#TimeUsernameProblemLanguageResultExecution timeMemory
1133714alterioDistributing Candies (IOI21_candies)C++20
0 / 100
60 ms9028 KiB
#include <bits/stdc++.h> #include "candies.h" using namespace std; #define ll long long vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) { int n = c.size(), q = l.size(); vector<int> s(n); ll prf[n + 1]; memset(prf, 0, sizeof(prf)); for (int i = 0; i < q; i++) prf[l[i]] += v[i], prf[r[i] + 1] -= v[i]; ll sum = 0; for (int i = 0; i < n; i++) { sum += prf[i]; s[i] = min((int) sum, c[i]); } 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...