Submission #1076122

#TimeUsernameProblemLanguageResultExecution timeMemory
1076122ItamarDistributing Candies (IOI21_candies)C++17
8 / 100
92 ms12884 KiB
#include "candies.h" #include<bits/stdc++.h> #define vi vector<int> using namespace std; #define ll long long #define vll vector<ll> 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(); vi ans(n); int m = r.size(); vll his(n+1); for(int i = 0; i < m; i++){ his[l[i]]+=v[i]; his[r[i]+1]-=v[i]; } ll sum = 0; for(int i = 0; i < n; i++){ sum+=his[i]; ans[i] = min((ll)c[i],sum); } 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...