Submission #1021452

# Submission time Handle Problem Language Result Execution time Memory
1021452 2024-07-12T18:26:33 Z Wael Distributing Candies (IOI21_candies) C++17
0 / 100
71 ms 10660 KB
#include "candies.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;

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> pref(n);
    for (int j = 0; j < q; ++j) {
        pref[l[j]] += v[j];
        if (r[j] + 1 < n) {
            pref[r[j] + 1] -= v[j];
        }
    }

    vector<int> s(n);
    for (int i = 0; i < n; ++i) {
        if (i) {
            pref[i] += pref[i - 1];
        }
        s[i] = min(c[i], pref[i]);
    }
    
    return s;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 71 ms 10660 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -