Submission #1051469

# Submission time Handle Problem Language Result Execution time Memory
1051469 2024-08-10T07:16:11 Z MarwenElarbi Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 13292 KB
#include <bits/stdc++.h>
using namespace std;
#include "candies.h"

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();
    vector<int> ans(n,0);
    for (int i = 0; i < l.size(); ++i)
    {
        for (int j = l[i]; j <= r[i]; ++j)
        {
            ans[j]+=v[i];
            if(ans[j]>c[j]) ans[j]=c[j];
            if(ans[j]<0) ans[j]=0;
        }
    }
    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 i = 0; i < l.size(); ++i)
      |                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5066 ms 7420 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 109 ms 8172 KB Output is correct
3 Correct 122 ms 6044 KB Output is correct
4 Execution timed out 5047 ms 13292 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 269 ms 7788 KB Output is correct
4 Correct 255 ms 3928 KB Output is correct
5 Execution timed out 5027 ms 10832 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 540 KB Output is correct
6 Execution timed out 5066 ms 7420 KB Time limit exceeded
7 Halted 0 ms 0 KB -