Submission #826553

#TimeUsernameProblemLanguageResultExecution timeMemory
826553SebDistributing Candies (IOI21_candies)C++17
0 / 100
81 ms8048 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) { int n = c.size(),sum=0; vector <int> ans(n),acom(n+1); for (int j=0;j<l.size();j++) { acom[l[j]] += v[j]; acom[r[j]+1] -= v[j]; } for (int i=0;i<n;i++) { sum += acom[i]; ans[i] = 0; ans[i] = min(sum,c[i]); } 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++) {
      |                  ~^~~~~~~~~
#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...