Submission #1058904

#TimeUsernameProblemLanguageResultExecution timeMemory
1058904LittleOrangeDistributing Candies (IOI21_candies)C++17
0 / 100
55 ms8272 KiB
#include "candies.h" #include <vector> #include<bits/stdc++.h> using namespace std; using ll = int; 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(); ll q = l.size(); vector<ll> a(n+1,0); for(ll i = 0;i<q;i++){ a[l[i]] += v[i]; a[r[i]+1] -= v[i]; } for(ll i = 0;i<n;i++) a[i+1] += a[i]; vector<ll> out(n,0); for(ll i = 0;i<n;i++) out[i] = min(c[i],a[i]); return out; }
#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...