Submission #941792

#TimeUsernameProblemLanguageResultExecution timeMemory
941792NumberzDistributing Candies (IOI21_candies)C++17
3 / 100
5077 ms13268 KiB
#include "candies.h" #include <bits/stdc++.h> using namespace std; vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) { int q = l.size(); vector<int> ans(c.size(), 0); for (int k = 0; k < c.size(); k++) { //we go through each box and now perform the check on each for (int day = 0; day < q; day++) { //if l r constraints if (k >= l[day] && k <= r[day]) { if (v[day] > 0) { ans[k] = min(c[k], ans[k] + v[day]); } else { ans[k] = max(0, ans[k] + v[day]); } } } } 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:9:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for (int k = 0; k < c.size(); k++) {
      |                     ~~^~~~~~~~~~
#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...