Submission #443344

# Submission time Handle Problem Language Result Execution time Memory
443344 2021-07-10T11:28:35 Z leinad2 Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 13260 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 n=c.size();
    vector<int>A;A.resize(n);
    int i, j;
    for(i=0;i<l.size();i++)
    {
        for(j=l[i];j<=r[i];j++)
        {
            A[j]+=v[i];
            if(A[j]<0)A[j]=0;
            if(A[j]>c[j])A[j]=c[j];
        }
    }
    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:9:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(i=0;i<l.size();i++)
      |             ~^~~~~~~~~
# 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 2 ms 300 KB Output is correct
5 Correct 7 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5040 ms 12108 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 527 ms 8020 KB Output is correct
3 Correct 559 ms 6008 KB Output is correct
4 Execution timed out 5036 ms 13260 KB Time limit exceeded
5 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 1457 ms 7644 KB Output is correct
4 Correct 1624 ms 4000 KB Output is correct
5 Execution timed out 5036 ms 10820 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 2 ms 300 KB Output is correct
5 Correct 7 ms 332 KB Output is correct
6 Execution timed out 5040 ms 12108 KB Time limit exceeded
7 Halted 0 ms 0 KB -