Submission #501968

# Submission time Handle Problem Language Result Execution time Memory
501968 2022-01-05T01:17:02 Z aun5x Distributing Candies (IOI21_candies) C++17
0 / 100
91 ms 12936 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] = min(0, box[i] + add);
        }
        else {
            box[i] = max(c[i], box[i] + add);
        }
    }
    return box;


}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 91 ms 12936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 280 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 276 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -