Submission #440229

# Submission time Handle Problem Language Result Execution time Memory
440229 2021-07-01T19:15:29 Z BaraaArmoush Distributing Candies (IOI21_candies) C++17
0 / 100
145 ms 7340 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

void minimize(int& x, int y) {
    if (x > y) {
        x = y;
    }
}

void maximize(int& x, int y) {
    if (x < y) {
        x = y;
    }
}

vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
    int n = c.size();
    int q = l.size();

    vector<int> a(n);

    for (int j = 0; j < q; j++) {
        a[l[j]] += v[j];
        if (r[j] + 1 < n) {
            a[r[j] + 1] -= v[j];
        }
    }

    for (int i = 1; i < n; i++) {
        a[i] += a[i - 1];
    }

    for (int i = 0; i < n; i++) {
        minimize(a[i], c[i]);
    }

    return a;
}
# 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 145 ms 7340 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 1 ms 204 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 -