Submission #438155

#TimeUsernameProblemLanguageResultExecution timeMemory
438155victoriadDistributing Candies (IOI21_candies)C++17
0 / 100
5058 ms7340 KiB
#include "candies.h" #include <vector> using namespace std; 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> s(n); for(int i=0;i<n;i++)s[i]=c[i]; for(int i=0;i<v.size();i++){ for(int k=l[i];k<=r[i];k++){ if(v[i]>0){ s[k]=min(c[k],s[k]+v[i]); } else{ s[k]=max(0,s[k]-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:17: 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...