Submission #830883

# Submission time Handle Problem Language Result Execution time Memory
830883 2023-08-19T12:27:38 Z Johann Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 13272 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()

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)
    {
        for (int i = l[q]; i <= r[q]; ++i)
        {
            S[i] += v[q];
            S[i] = max(S[i], 0);
            S[i] = min(S[i], c[i]);
        }
    }

    return S;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5029 ms 12080 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 188 ms 8040 KB Output is correct
3 Correct 172 ms 5964 KB Output is correct
4 Execution timed out 5061 ms 13272 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 458 ms 7768 KB Output is correct
4 Correct 449 ms 3992 KB Output is correct
5 Execution timed out 5049 ms 10796 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Execution timed out 5029 ms 12080 KB Time limit exceeded
7 Halted 0 ms 0 KB -