Submission #438966

#TimeUsernameProblemLanguageResultExecution timeMemory
438966jlozano254Distributing Candies (IOI21_candies)C++17
3 / 100
5099 ms13252 KiB
#include "candies.h" #include <vector> 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(); std::vector<int> s(n); for (int i = 0; i <= v.size(); ++i) { for (int j = l[i]; j <= r[i]; ++j) { if (v[i] < 0) { s[j] = std::max(0, s[j] + v[i]); } else { s[j] = std::min(c[j], s[j] + v[i]); } } } return s; }

Compilation message (stderr)

candies.cpp: In function 'std::vector<int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
candies.cpp:10:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for (int i = 0; i <= v.size(); ++i)
      |                     ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...