Submission #618083

# Submission time Handle Problem Language Result Execution time Memory
618083 2022-08-01T21:39:21 Z BalintR Distributing Candies (IOI21_candies) C++17
38 / 100
5000 ms 8940 KB
#include <vector>
using namespace std;
#pragma GCC optimize "Ofast"
typedef vector<int> vi;
#define SZ(v) ((int) (v).size())
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) < (b) ? (b) : (a))

const int MN = 2e5;
int n, q;
int arr[MN], cap[MN];

vi distribute_candies(vi cIn, vi lIn, vi rIn, vi vIn){
    n = SZ(cIn);
    q = SZ(lIn);
    for(int i = 0; i < n; i++) cap[i] = cIn[i];

    for(int i = 0; i < q; i++){
        int l = lIn[i], r = rIn[i]+1, v = vIn[i];
        if(v < 0) for(int j = l; j < r; j++) arr[j] = max(arr[j] + v, 0);
        else for(int j = l; j < r; j++) arr[j] = min(arr[j] + v, cap[j]);
    }

    vi res(n);
    for(int i = 0; i < n; i++) res[i] = arr[i];
    return res;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3576 ms 8940 KB Output is correct
2 Correct 3827 ms 8896 KB Output is correct
3 Correct 3689 ms 8900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 85 ms 4964 KB Output is correct
3 Correct 74 ms 5360 KB Output is correct
4 Correct 3254 ms 8892 KB Output is correct
5 Correct 3203 ms 8900 KB Output is correct
6 Correct 3574 ms 8896 KB Output is correct
7 Correct 3280 ms 8896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 153 ms 5040 KB Output is correct
4 Correct 147 ms 4340 KB Output is correct
5 Execution timed out 5043 ms 8036 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 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 3576 ms 8940 KB Output is correct
7 Correct 3827 ms 8896 KB Output is correct
8 Correct 3689 ms 8900 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 85 ms 4964 KB Output is correct
11 Correct 74 ms 5360 KB Output is correct
12 Correct 3254 ms 8892 KB Output is correct
13 Correct 3203 ms 8900 KB Output is correct
14 Correct 3574 ms 8896 KB Output is correct
15 Correct 3280 ms 8896 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 153 ms 5040 KB Output is correct
19 Correct 147 ms 4340 KB Output is correct
20 Execution timed out 5043 ms 8036 KB Time limit exceeded
21 Halted 0 ms 0 KB -