# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1125495 | zNatsumi | Catfish Farm (IOI22_fish) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#include "fish.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, vector<int> _X, vector<int> _Y, vector<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
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);
}
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);
}
#endif