Submission #1133716

#TimeUsernameProblemLanguageResultExecution timeMemory
1133716alterioDistributing Candies (IOI21_candies)C++20
8 / 100
60 ms9032 KiB
#include <bits/stdc++.h> #include "candies.h" using namespace std; #define ll unsigned 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(sum, (ll) 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...