Submission #826549

#TimeUsernameProblemLanguageResultExecution timeMemory
826549SebDistributing Candies (IOI21_candies)C++17
0 / 100
76 ms18084 KiB
#include "candies.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l, std::vector<int> r, std::vector<int> v) { ll n = c.size(); vector <int> ans; for (int j=0;j<l.size();j++) for (int i=l[j];i<=r[j];i++) ans[i] = max(min(c[i],ans[i]+v[j]),0); 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:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for (int j=0;j<l.size();j++) for (int i=l[j];i<=r[j];i++) ans[i] = max(min(c[i],ans[i]+v[j]),0);
      |                  ~^~~~~~~~~
candies.cpp:9:8: warning: unused variable 'n' [-Wunused-variable]
    9 |     ll n = c.size();
      |        ^
#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...