#include <bits/stdc++.h>
/*#define int long long
#define mp make_pair
#define all(a) a.begin(),a.end()
using namespace std;
using pii = pair <int, int>;
constexpr int maxn = 1e5 + 10;
constexpr long long inf = 1e17 + 10;
vector <pii> tree (maxn << 2, mp (0, -inf));
vector <pii> A (maxn << 2, mp (-inf, -inf));
inline void push (int v, int t_l, int t_r) {
tree[v].first = max (tree[v].first, A[v].first);
tree[v].second = max (tree[v].second, A[v].second);
if (t_l != t_r) {
A[v << 1].first = max (A[v << 1].first, A[v].first);
A[v << 1].second = max (A[v << 1].second, A[v].second);
A[v << 1 | 1].first = max (A[v << 1 | 1].first, A[v].first);
A[v << 1 | 1].second = max (A[v << 1 | 1].second, A[v].second);
}
A[v] = mp (-inf, -inf);
}
inline void update (int l, int r, pii x, int v, int t_l, int t_r) {
push (v, t_l, t_r);
if (l > t_r || t_l > r) return;
if (l <= t_l && t_r <= r) {
A[v] = x;
push (v, t_l, t_r);
return;
}
int t_m = t_l + t_r >> 1;
update (l, r, x, v << 1, t_l, t_m);
update (l, r, x, v << 1 | 1, t_m + 1, t_r);
tree[v].first = max (tree[v << 1].first, tree[v << 1 | 1].first);
tree[v].second = max (tree[v << 1].second, tree[v << 1 | 1].second);
}
inline pii get (int i, int v, int t_l, int t_r) {
if (i > t_r || t_l > i) return mp (-inf, -inf);
push (v, t_l, t_r);
if (t_l == t_r) return tree[v];
int t_m = t_l + t_r >> 1;
return max (get (i, v << 1, t_l, t_m), get (i, v << 1 | 1, t_m + 1, t_r));
}
vector <pii> pos [maxn];
int last = 0;*/
long long max_weights (int N, int M, vector <int> X, vector <int> Y, vector <int> W) {
/*for (int i = 0; i < M; ++i) {
pos[X[i] + 1].push_back (mp (Y[i] + 1, W[i]));
}
int n = N;
for (int i = 1; i <= n; ++i) sort (all (pos[i]));
for (int i = 1; i <= n; ++i) {
for (pii j : pos[i]) {
int am = get (j.first, 1, 0, n).first + j.second;
update (j.first + 1, n, mp (am, -inf), 1, 0, n);
}
for (int _j = (int) pos[i].size () - 1; _j >= 0; --_j) {
pii j = pos[i][_j];
int am = get (j.first, 1, 0, n).second + j.second;
update (0, j.first - 1, mp (-inf, am), 1, 0, n);
}
int to = get (n, 1, 0, n).first, from = get (0, 1, 0, n).second;
update (0, n, mp (from, last), 1, 0, n);
last = max (to, from);
}
return get (0, 1, 0, n).second;*/
long long res = 0;
for (int i = 0; i < M; ++i) res += W[i];
return res;
}
Compilation message
fish.cpp:51:38: error: 'vector' has not been declared
51 | long long max_weights (int N, int M, vector <int> X, vector <int> Y, vector <int> W) {
| ^~~~~~
fish.cpp:51:45: error: expected ',' or '...' before '<' token
51 | long long max_weights (int N, int M, vector <int> X, vector <int> Y, vector <int> W) {
| ^
fish.cpp: In function 'long long int max_weights(int, int, int)':
fish.cpp:73:40: error: 'W' was not declared in this scope
73 | for (int i = 0; i < M; ++i) res += W[i];
| ^