Submission #451555

# Submission time Handle Problem Language Result Execution time Memory
451555 2021-08-03T08:48:38 Z T0p_ Distributing Candies (IOI21_candies) C++17
0 / 100
128 ms 10844 KB
#include "candies.h"
#include <bits/stdc++.h>
using namespace std;

const int N = 2e5+5;

int n, q;
long long arr[N], capacity[N];

vector<int> distribute_candies(vector<int> c, vector<int> l,
                                    vector<int> r, vector<int> v) {
    n = c.size(), q = l.size();
    for(int i=1 ; i<=n ; i++) capacity[i] = c[i-1];
    for(int i=0 ; i<q ; i++)
    {
        int a = l[i]+1, b = r[i]+1, c = v[i];
        if(c < 0) return {};
        arr[a] += c;
        arr[b+1] -= c;
    }
    for(int i=1 ; i<=n ; i++) arr[i] += arr[i-1];
    vector<int> ret;
    for(int i=1 ; i<=n ; i++) ret.push_back(arr[i]);
    return ret;
}
# 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 128 ms 10844 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 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -