# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
625543 | clams | Catfish Farm (IOI22_fish) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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';
}