Submission #438966

# Submission time Handle Problem Language Result Execution time Memory
438966 2021-06-29T02:08:17 Z jlozano254 Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 13252 KB
#include "candies.h"

#include <vector>

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

    for (int i = 0; i <= v.size(); ++i)
    {
        for (int j = l[i]; j <= r[i]; ++j)
        {
            if (v[i] < 0) {
                s[j] = std::max(0, s[j] + v[i]);
            }
            else {
                s[j] = std::min(c[j], s[j] + v[i]);
            }
        }
    }

    return s;
}

Compilation message

candies.cpp: In function 'std::vector<int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
candies.cpp:10:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for (int i = 0; i <= v.size(); ++i)
      |                     ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 5 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5073 ms 7208 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 209 ms 8068 KB Output is correct
3 Correct 196 ms 6000 KB Output is correct
4 Execution timed out 5085 ms 13252 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 489 ms 7632 KB Output is correct
4 Correct 467 ms 3992 KB Output is correct
5 Execution timed out 5099 ms 10776 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 5 ms 332 KB Output is correct
6 Execution timed out 5073 ms 7208 KB Time limit exceeded
7 Halted 0 ms 0 KB -