Submission #545866

#TimeUsernameProblemLanguageResultExecution timeMemory
545866fuad27Distributing Candies (IOI21_candies)C++17
3 / 100
5089 ms13228 KiB
#include<bits/stdc++.h> #include "candies.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> s(n, 0); for(int i = 0;i<r.size();i++) { for(int j = 0;j<n;j++) { if(j >= l[i] and j <= r[i]) { if(v[i] > 0) { s[j] = min(c[j], s[j] + v[i]); } else { s[j] = max(0, 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:7:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |  for(int i = 0;i<r.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...