Submission #824778

# Submission time Handle Problem Language Result Execution time Memory
824778 2023-08-14T09:59:04 Z andrei_boaca Distributing Candies (IOI21_candies) C++17
3 / 100
87 ms 12960 KB
#include "candies.h"
#include <bits/stdc++.h>
#include <vector>
//#include "grader.cpp"
using namespace std;

int n,q;
vector<int> v;
std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> stanga,std::vector<int> dreapta, std::vector<int> vals)
{
    n = c.size();
    q=stanga.size();
    v.resize(n);
    if(n<=2000&&q<=2000)
    {
        for(int z=0;z<stanga.size();z++)
        {
            int l=stanga[z];
            int r=dreapta[z];
            int val=vals[z];
            for(int i=l;i<=r;i++)
            {
                v[i]+=val;
                if(v[i]<0)
                    v[i]=0;
                if(v[i]>c[i])
                    v[i]=c[i];
            }
        }
        return v;
    }
    return v;
}

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:16:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         for(int z=0;z<stanga.size();z++)
      |                     ~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Correct 2 ms 368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 87 ms 12960 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 63 ms 8016 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 42 ms 7648 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Correct 2 ms 368 KB Output is correct
6 Incorrect 87 ms 12960 KB Output isn't correct
7 Halted 0 ms 0 KB -