Submission #436248

#TimeUsernameProblemLanguageResultExecution timeMemory
436248ApiramDistributing Candies (IOI21_candies)C++17
3 / 100
5041 ms7340 KiB
#include "candies.h" #include<bits/stdc++.h> 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>ans(n,0); for (int i = 0;i<l.size();++i){ for (int j =l[i];j<=r[i];++j){ ans[j]=max(0,min(ans[j]+v[i],c[j])); } } return ans; }

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:11:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for (int i = 0;i<l.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...