Submission #894871

#TimeUsernameProblemLanguageResultExecution timeMemory
894871Sir_Ahmed_ImranDistributing Candies (IOI21_candies)C++17
Compilation error
0 ms0 KiB
///~~~LOTA~~~/// #include "candies.h" #include <bits/stdc++.h> using namespace std; #define nl '\n' #define ff first #define ss second #define ll long long #define append push_back #define pii pair<int,int> #define all(x) (x).begin(),(x).end() #define N 300001 vector<ll> distribute_candies(vector<int> c,vector<int> l,vector<int> r,vector<int> v){ ll o,p,q; vector<ll> x,y; for(int i=o=0;i<c.size();i++) y.append(0); for(int i=0;i<l.size();i++){ p=v[i]; for(int j=l[i];j<=r[i];j++){ q=c[j]; if(v[i]>0) o+=min(p,q-y[j]); else o+=max(p,-y[j]); y[j]=max(0LL,min(q,y[j]+p)); } x.append(o); } return x; }

Compilation message (stderr)

candies.cpp:13:12: error: ambiguating new declaration of 'std::vector<long long int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)'
   13 | vector<ll> distribute_candies(vector<int> c,vector<int> l,vector<int> r,vector<int> v){
      |            ^~~~~~~~~~~~~~~~~~
In file included from candies.cpp:2:
candies.h:3:18: note: old declaration 'std::vector<int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)'
    3 | std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,
      |                  ^~~~~~~~~~~~~~~~~~
candies.cpp: In function 'std::vector<long long int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
candies.cpp:16:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(int i=o=0;i<c.size();i++)
      |                   ~^~~~~~~~~
candies.cpp:18:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(int i=0;i<l.size();i++){
      |                 ~^~~~~~~~~