Submission #830884

# Submission time Handle Problem Language Result Execution time Memory
830884 2023-08-19T12:30:51 Z Johann Distributing Candies (IOI21_candies) C++17
0 / 100
93 ms 8500 KB
#include "candies.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

int N, Q;

std::vector<int> distribute_candies(vi c, vi l, vi r, vi v)
{
    N = sz(c);
    Q = sz(l);
    vi S(N, 0);

    for (int q = 0; q < Q; ++q)
    {
        S[l[q]] += v[q];
        S[++r[q]] -= v[q];
    }
    partial_sum(all(S), S.begin());
    for (int i = 0; i < N; ++i)
        S[i] = min(c[i], S[i]);

    vector<int> ans;
    for (ll x : S)
        ans.push_back(x);

    return S;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 93 ms 8500 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -