# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1125493 | zNatsumi | Catfish Farm (IOI22_fish) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5,
M = 3e5 + 5;
int n, m;
struct info{
int x, y, w;
info(){}
info(int x, int y, int w): x(x), y(y), w(w) {}
} fish[M];
namespace sub1{
long long solve(){
long long res = 0LL;
for(int i = 0; i < m; i++) res += fish[i].w;
return res;
}
}
int64_t max_weights(int _N, int _M, int _X[], int _Y[], int _W[]){
n = _N; m = _M;
for(int i = 0; i < m; i++) fish[i] = info(_X[i], _Y[i], _W[i]);
bool flag1 = true;
for(int i = 0; i < m; i++) if(fish[i].x & 1){ flag1 = false; break; }
if(flag1) return sub1::solve();
return 0;
}
//#define zNatsumi
#ifdef zNatsumi
int _N, _M, _X[M], _Y[M], _W[M];
int32_t main(){
cin.tie(0)->sync_with_stdio(0);
#define task "test"
if(fopen(task ".inp", "r")){
freopen(task ".inp", "r", stdin);
freopen(task ".out", "w", stdout);
}
cin >> _N >> _M;
for(int i = 0; i < _M; i++) cin >> _X[i] >> _Y[i] >> _W[i];
cout << max_weights(_N, _M, _X, _Y, _W);
}
#endif