Submission #441779

#TimeUsernameProblemLanguageResultExecution timeMemory
441779baluteshihDistributing Candies (IOI21_candies)C++17
3 / 100
5078 ms9668 KiB
#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define X first
#define Y second
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define SZ(a) ((int)a.size())

vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
    int n = c.size();
    vector<int> rt(n, 0);
    for (int i = 0; i < SZ(l); ++i)
        for (int j = l[i]; j <= r[i]; ++j) {
            rt[j] += v[i];
            if (rt[j] > c[j])
                rt[j] = c[j];
            if (rt[j] < 0)
                rt[j] = 0;
        }
    return rt;
}
#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...