Submission #501969

# Submission time Handle Problem Language Result Execution time Memory
501969 2022-01-05T01:21:46 Z aun5x Distributing Candies (IOI21_candies) C++17
0 / 100
97 ms 8016 KB
#include "candies.h"

#include <vector>
using namespace std;

vector<int> distribute_candies(vector<int> c, vector<int> l,
                                    vector<int> r, vector<int> v) {
    int q = l.size();
    int n = c.size();
    vector<int> adder (n,0);
    vector<int> box(n,0);
    for (int i = 0; i < q; i++)
    {
        adder[l[q]] += v[q];
        if (r[q]+1 < n) adder[r[q]+1] -= v[q];
    }
    int add = 0;
    for (int i = 0; i < n; i++)
    {
        add += adder[i];
        if (add < 0)
        {
            box[i] = max(0, box[i] + add);
        }
        else {
            box[i] = min(c[i], box[i] + add);
        }
    }
    return box;


}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 97 ms 8016 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -