Submission #1058604

#TimeUsernameProblemLanguageResultExecution timeMemory
1058604qwushaDistributing Candies (IOI21_candies)C++17
Compilation error
0 ms0 KiB
#include "candies.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define fi first #define se second typedef long double ld; const ld eps = 1e-8; mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); const ll inf = 1e18; const ll mod = 1e9 + 7; vector<ll> distribute_candies(vector<ll> c, vector<ll> l, vector<ll> r, vector<ll> v) { ll n = c.size(); vector<ll> res(n); for (ll qw = 0; qw < l.size(); qw++) { for (ll i = l[qw]; i <= r[qw]; i++) { if (v[qw] > 0) { res[i] = min(res[i] + v[qw], c[i]); } else { res[i] = max(res[i] + v[qw], 0ll); } } } return res; }

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:18:24: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for (ll qw = 0; qw < l.size(); qw++) {
      |                     ~~~^~~~~~~~~~
/usr/bin/ld: /tmp/ccUEhluP.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