Submission #1062728

# Submission time Handle Problem Language Result Execution time Memory
1062728 2024-08-17T10:04:54 Z fv3 Distributing Candies (IOI21_candies) C++17
8 / 100
66 ms 12884 KB
#include "candies.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

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<ll> ps(N+1);

    for (int q = 0; q < Q; q++)
    {
        ps[l[q]] += v[q];
        ps[r[q]+1] -= v[q];
    }

    vector<int> s(N);
    ll sum = 0;
    for (int i = 0; i < N; i++)
    {
        sum += ps[i];
        s[i] = min((ll)c[i], sum);
    }
    return s;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 65 ms 9044 KB Output is correct
2 Correct 65 ms 12884 KB Output is correct
3 Correct 66 ms 12780 KB Output is correct
# 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 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -