# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
792106 | 6aren | 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;
#ifdef LOCAL
#include <cp/debugger.hpp>
#else
#define debug(...) 42
#endif
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
typedef long long int64;
typedef pair<int, int> ii;
int64 max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w) {
int64 res0 = 0, res1 = 0;
for (int i = 0; i < m; i++) {
if (x[i] == 0) res0 += w[i];
else res1 += w[i];
}
return max(res0, res1);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<int> x(m), y(m), w(m);
for (int i = 0; i < m; i++) {
cin >> x[i] >> y[i] >> w[i];
}
cout << max_weights(n, m, x, y, w) << '\n';
return 0;
}