(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #599932

#TimeUsernameProblemLanguageResultExecution timeMemory
599932Valaki2Distributing Candies (IOI21_candies)C++17
8 / 100
121 ms12972 KiB
#include "candies.h" #include <bits/stdc++.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(); int q = v.size(); vector<int> ans(n, 0); vector<ll> diff(n + 1, 0); for(int i = 0; i < q; i++) { diff[l[i]] = diff[l[i]] + v[i]; diff[r[i] + 1] = diff[r[i] + 1] - v[i]; } ll sum = 0; for(int i = 0; i < n; i++) { sum = sum + diff[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...