Submission #894870

#TimeUsernameProblemLanguageResultExecution timeMemory
894870Sir_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<ll> c,vector<ll> l,vector<ll> r,vector<ll> v){ ll o=0; vector<ll> x,y; for(int i=0;i<c.size();i++) y.append(0); for(int i=0;i<l.size();i++){ for(int j=l[i];j<=r[i];j++){ if(v[i]>0) o+=min(v[i],c[j]-y[j]); else o+=max(v[i],-y[j]); y[j]=max(0LL,min(c[j],y[j]+v[i])); } x.append(o); } return x; }

Compilation message (stderr)

candies.cpp: In function 'std::vector<long long int> distribute_candies(std::vector<long long int>, std::vector<long long int>, std::vector<long long int>, std::vector<long long int>)':
candies.cpp:16:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(int i=0;i<c.size();i++)
      |                 ~^~~~~~~~~
candies.cpp:18:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(int i=0;i<l.size();i++){
      |                 ~^~~~~~~~~
/usr/bin/ld: /tmp/cc6WK6gc.o: in function `main':
grader.cpp:(.text.startup+0x30e): undefined reference to `distribute_candies(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status