Submission #1058594

# Submission time Handle Problem Language Result Execution time Memory
1058594 2024-08-14T11:23:16 Z qwusha Distributing Candies (IOI21_candies) C++17
Compilation error
0 ms 0 KB
#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;

#include "candies.h"

vector<int> distribute_candies(vector<int> &c, vector<int> &l, vector<int> &r, vector<int> &v) {
    int n = c.size();
    vector<int> res(n);
    for (int qw = 0; qw < l.size(); qw++) {
        for (int 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], 0);
            }
        }
    }
    return res;
}

Compilation message

candies.cpp: In function 'std::vector<int> distribute_candies(std::vector<int>&, std::vector<int>&, std::vector<int>&, std::vector<int>&)':
candies.cpp:17:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for (int qw = 0; qw < l.size(); qw++) {
      |                      ~~~^~~~~~~~~~
/usr/bin/ld: /tmp/cc2VgxCd.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