답안 #847922

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
847922 2023-09-10T20:43:20 Z evenvalue 사탕 분배 (IOI21_candies) C++17
컴파일 오류
0 ms 0 KB
#include "candies.h"

#include <cassert>
#include <cstdio>
#include <vector>

int main() {
    int n;
    assert(1 == scanf("%d", &n));
    std::vector<int> c(n);
    for(int i = 0; i < n; ++i) {
        assert(scanf("%d", &c[i]) == 1);
    }

    int q;
    assert(1 == scanf("%d", &q));
    std::vector<int> l(q), r(q), v(q);
    for(int i = 0; i < q; ++i) {
        assert(scanf("%d %d %d", &l[i], &r[i], &v[i]) == 3);
    }

    std::vector<int> ans = distribute_candies(c, l, r, v);

    for(int i = 0; i < (int)ans.size(); ++i) {
        if (i > 0) {
            printf(" ");
        }
        printf("%d", ans[i]);
    }
    printf("\n");
    fclose(stdout);
    return 0;
}

Compilation message

/usr/bin/ld: /tmp/cc8BJNEA.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cccR47HC.o:candies.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cccR47HC.o: in function `main':
candies.cpp:(.text.startup+0x1b7): 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> >)'
/usr/bin/ld: /tmp/cc8BJNEA.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