Submission #807728

# Submission time Handle Problem Language Result Execution time Memory
807728 2023-08-04T23:31:08 Z Mouad_ouj Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 13276 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)
{
    vector<int> a;
    a.assign(c.size(),0);
    for(int y=0;y<l.size();y++)
    {
        for(int x=l[y];x<=r[y];x++)
        {
            if(v[y]>0)
            a[x]=min(a[x]+v[y],c[x]);
            else
            a[x]=max(a[x]+v[y],0);
        }
    }
    return a;
}

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:8:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for(int y=0;y<l.size();y++)
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5080 ms 7268 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 169 ms 8044 KB Output is correct
3 Correct 158 ms 6020 KB Output is correct
4 Execution timed out 5047 ms 13276 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 408 ms 7592 KB Output is correct
4 Correct 400 ms 4012 KB Output is correct
5 Execution timed out 5039 ms 10828 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Execution timed out 5080 ms 7268 KB Time limit exceeded
7 Halted 0 ms 0 KB -