Submission #941792

# Submission time Handle Problem Language Result Execution time Memory
941792 2024-03-09T12:20:51 Z Numberz Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 13268 KB
#include "candies.h"
#include <bits/stdc++.h>
using namespace std;

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

    for (int k = 0; k < c.size(); k++) {
        //we go through each box and now perform the check on each
        for (int day = 0; day < q; day++) {
            //if l r constraints
            if (k >= l[day] && k <= r[day]) {
                if (v[day] > 0) {
                    ans[k] = min(c[k], ans[k] + v[day]);
                }
                else {
                    ans[k] = max(0, ans[k] + v[day]);
                }
            }
        }
    }

    return ans;
}

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:9:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for (int k = 0; k < c.size(); k++) {
      |                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 448 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 8 ms 544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5077 ms 12248 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2243 ms 8164 KB Output is correct
3 Correct 713 ms 6020 KB Output is correct
4 Execution timed out 5013 ms 13268 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2242 ms 7780 KB Output is correct
4 Correct 631 ms 4028 KB Output is correct
5 Execution timed out 5042 ms 10836 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 448 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 8 ms 544 KB Output is correct
6 Execution timed out 5077 ms 12248 KB Time limit exceeded
7 Halted 0 ms 0 KB -