Submission #625543

# Submission time Handle Problem Language Result Execution time Memory
625543 2022-08-10T14:37:14 Z clams Catfish Farm (IOI22_fish) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

ll max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w) {
    bool issub1 = 1;
    for (int i = 0; i < m; i++) {
        if (x[i] & 1) {
            issub1 = 0;
            break;
        }
    }

    if (issub1) {
        // just sum up every thing
        ll ans = accumulate(w.begin(), w.end(), 0LL);
        return ans;
    }

    bool issub2 = 1;
    for (int i = 0; i < m; i++) {
        if (x[i] > 1) {
            issub2 = 0;
            break;
        }
    }

    if (issub2) {
        // there is only two columns
        vector<ll> col(2);
        for (int i = 0; i < m; i++) {
            col[x[i]] += w[i];
        }

        return max(col[0], col[1]);
    }

    return 0;
}

int main() {
//    int tmp = 2e9;
//    cout << max_weights(5, 4, {1, 0, 1, 0}, {2, 1, 4, 3}, {tmp, tmp, tmp, tmp}) << '\n';
//    cout << max_weights(5, 4, {0, 1, 4, 3}, {2, 1, 4, 3}, {5, 2, 1, 3}) << '\n';
}

Compilation message

/usr/bin/ld: /tmp/ccugxjH9.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cczw7Cjb.o:fish.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status