#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
#define int long logn
long long max_weights(int32_t N, int32_t M, std::vector<int32_t> X, std::vector<int32_t> Y, std::vector<int32_t> W) {
int ans = 0;
for (int i = 0; i < M; i++) ans += W[i];
return ans;
}
#ifndef EVAL
#include "fish.h"
#include <cassert>
#include <cstdio>
#include <vector>
int main() {
int N, M;
assert(2 == scanf("%d %d", &N, &M));
std::vector<int> X(M), Y(M), W(M);
for (int i = 0; i < M; ++i) {
assert(3 == scanf("%d %d %d", &X[i], &Y[i], &W[i]));
}
long long result = max_weights(N, M, X, Y, W);
printf("%lld\n", result);
return 0;
}
#endif
Compilation message
fish.cpp: In function 'long long int max_weights(int32_t, int32_t, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:8:9: error: expected initializer before 'ans'
8 | int ans = 0;
| ^~~
fish.cpp:9:14: error: expected ';' before 'i'
9 | for (int i = 0; i < M; i++) ans += W[i];
| ^
fish.cpp:9:14: error: 'i' was not declared in this scope
fish.cpp:9:26: error: expected ')' before ';' token
9 | for (int i = 0; i < M; i++) ans += W[i];
| ~ ^
| )
fish.cpp:9:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
9 | for (int i = 0; i < M; i++) ans += W[i];
| ^~~
fish.cpp:9:28: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
9 | for (int i = 0; i < M; i++) ans += W[i];
| ^
fish.cpp:5:18: warning: unused variable 'logn' [-Wunused-variable]
5 | #define int long logn
| ^~~~
fish.cpp:9:10: note: in expansion of macro 'int'
9 | for (int i = 0; i < M; i++) ans += W[i];
| ^~~
fish.cpp:9:28: error: 'i' was not declared in this scope
9 | for (int i = 0; i < M; i++) ans += W[i];
| ^
fish.cpp:10:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
10 | return ans;
| ^~~
| abs