Submission #625477

# Submission time Handle Problem Language Result Execution time Memory
625477 2022-08-10T13:08:10 Z I_love_Hoang_Yen Catfish Farm (IOI22_fish) C++17
Compilation error
0 ms 0 KB
#include "bits/stdc++.h"
using namespace std;

#define int long long
struct Fish {
    int col, row;
    int weight;
};

int sub1(const std::vector<Fish>& fishes) {
    int res = 0;
    for (const auto& fish : fishes) {
        res += fish.weight;
    }
    return res;
}

int solve(int n, const std::vector<Fish>& fishes) {
    if (std::all_of(
                fishes.begin(), fishes.end(),
                [] (const Fish& f) { return f.col % 2 == 0; })) {
        return sub1(fishes);
    }
}

int max_weights(int n, int nFish, int x[], int y[], int w[]) {
    std::vector<Fish> fishes;
    for (int i = 0; i < n; ++i) {
        fishes.push_back({x[i], y[i], w[i]});
    }
    return solve(n, fishes);
}

Compilation message

fish.cpp: In function 'long long int solve(long long int, const std::vector<Fish>&)':
fish.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^
/usr/bin/ld: /tmp/ccl6AIJP.o: in function `main':
grader.cpp:(.text.startup+0x25e): undefined reference to `max_weights(int, 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