Submission #440230

#TimeUsernameProblemLanguageResultExecution timeMemory
440230BaraaArmoushDistributing Candies (IOI21_candies)C++17
0 / 100
126 ms8800 KiB
#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<int> a(n); vector<ll> p(n + 1); for (int j = 0; j < q; j++) { p[l[j]] += v[j]; p[r[j]] -= v[j]; } for (int i = 1; i <= n; i++) { p[i] += p[i - 1]; } for (int i = 0; i < n; i++) { a[i] = min((ll)c[i], p[i]); } return a; }
#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...