#include <bits/stdc++.h>
using namespace std;
/*#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;*/
int 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;*/
int res = 0;
for (int i = 0; i < M; ++i) res += W[i];
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
2124 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '709728670' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
43 ms |
4000 KB |
1st lines differ - on the 1st token, expected: '40604614618209', found: '1040403569' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
13 ms |
1492 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '3978783222' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '4044', found: '6066' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '4044', found: '6066' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '4044', found: '6066' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
13 ms |
1492 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '3978783222' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
2124 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '709728670' |
2 |
Halted |
0 ms |
0 KB |
- |