Submission #435014

# Submission time Handle Problem Language Result Execution time Memory
435014 2021-06-22T19:27:21 Z Hegdahl Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 7264 KB
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,ssse3,sse4,mmx")

#include "candies.h"
#include <bits/stdc++.h>

#define ar array

using namespace std;

vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
    int n = (int)c.size();
    int q = (int)v.size();

    vector<int> s(n);

    for (int qq = 0; qq < q; ++qq) {
        int i = l[qq], j = r[qq], x = v[qq];
        for (int k = i; k <= j; ++k)
            s[k] += x;

        for (int k = i; k <= j; ++k)
            if (s[k] < 0)
                s[k] = 0;

        for (int k = i; k <= j; ++k)
            if (s[k] > c[k])
                s[k] = c[k];
    }

    return s;
}
# 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 6 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5071 ms 7264 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 205 ms 5020 KB Output is correct
3 Correct 186 ms 3820 KB Output is correct
4 Execution timed out 5089 ms 7264 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 719 ms 5012 KB Output is correct
4 Correct 766 ms 2800 KB Output is correct
5 Execution timed out 5085 ms 7224 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 6 ms 332 KB Output is correct
6 Execution timed out 5071 ms 7264 KB Time limit exceeded
7 Halted 0 ms 0 KB -