답안 #1058633

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1058633 2024-08-14T11:39:16 Z qwusha 사탕 분배 (IOI21_candies) C++17
컴파일 오류
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<ll> distribute_candies(vector<ll> c, vector<int> l, vector<int> r, vector<int> v) {
    ll n = c.size();
    vector<ll> res(n);
    vector<ll> pref(n + 1);
    for (int qw = 0; qw < l.size(); qw++) {
        pref[l[qw]] += v[qw];
        pref[r[qw] + 1] -= v[qw];
    }
    for (int i = 1; i < n; i++) {
        pref[i] += pref[i - 1];
    }
    for (int i = 0; i < n; i++) {
        res[i] = min(c[i], pref[i]);
    }
    return res;
}

Compilation message

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