Submission #440227

# Submission time Handle Problem Language Result Execution time Memory
440227 2021-07-01T19:13:11 Z BaraaArmoush Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 13252 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

void minimize(int& x, int y) {
    if (x > y) {
        x = y;
    }
}

void maximize(int& x, int y) {
    if (x < y) {
        x = y;
    }
}

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<int> a(n);

    for (int j = 0; j < q; j++) {
        for (int i = l[j]; i <= r[j]; i++) {
            a[i] += v[j];
            maximize(a[i], 0);
            minimize(a[i], c[i]);
        }
    }

    return a;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 3 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5033 ms 7224 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 210 ms 6100 KB Output is correct
3 Correct 207 ms 6008 KB Output is correct
4 Execution timed out 5061 ms 13252 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 494 ms 6096 KB Output is correct
4 Correct 493 ms 4004 KB Output is correct
5 Execution timed out 5030 ms 10820 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 3 ms 460 KB Output is correct
6 Execution timed out 5033 ms 7224 KB Time limit exceeded
7 Halted 0 ms 0 KB -