#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) {
vector<ll> pref0(N+1), pref1(N+1);
for (int i = 0; i < M; i++) {
if (X[i] == 0) pref0[Y[i] + 1] += W[i];
else pref1[Y[i] + 1] += W[i];
}
for (int i = 1; i <= N; i++) {
pref0[i] += pref0[i-1]; pref1[i] += pref1[i-1];
}
ll s1 = 0, s2 = 0, s3 = 0;
for (int i = 0; i <= N; i++) {
s1 = max(s1, pref1[i]);
s2 = max(s2, pref0[i]);
s3 = max(s3, pref1[N] - pref1[i] + pref0[i]);
}
if (N == 2) return max(s1, s2);
return max(s1, max(s2, s3));
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
3532 KB |
Output is correct |
2 |
Correct |
30 ms |
4172 KB |
Output is correct |
3 |
Correct |
2 ms |
1748 KB |
Output is correct |
4 |
Correct |
2 ms |
1876 KB |
Output is correct |
5 |
Correct |
93 ms |
8796 KB |
Output is correct |
6 |
Incorrect |
102 ms |
8804 KB |
1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000' |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
55 ms |
5404 KB |
Output is correct |
3 |
Correct |
80 ms |
6484 KB |
Output is correct |
4 |
Correct |
26 ms |
3532 KB |
Output is correct |
5 |
Correct |
32 ms |
4128 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
1876 KB |
Output is correct |
11 |
Correct |
2 ms |
1876 KB |
Output is correct |
12 |
Correct |
35 ms |
3576 KB |
Output is correct |
13 |
Correct |
34 ms |
4160 KB |
Output is correct |
14 |
Correct |
34 ms |
3536 KB |
Output is correct |
15 |
Correct |
28 ms |
3940 KB |
Output is correct |
16 |
Correct |
29 ms |
3556 KB |
Output is correct |
17 |
Correct |
43 ms |
3908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1876 KB |
Output is correct |
2 |
Correct |
2 ms |
1748 KB |
Output is correct |
3 |
Incorrect |
25 ms |
2864 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742' |
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 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046' |
10 |
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 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046' |
10 |
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 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1876 KB |
Output is correct |
2 |
Correct |
2 ms |
1748 KB |
Output is correct |
3 |
Incorrect |
25 ms |
2864 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
3532 KB |
Output is correct |
2 |
Correct |
30 ms |
4172 KB |
Output is correct |
3 |
Correct |
2 ms |
1748 KB |
Output is correct |
4 |
Correct |
2 ms |
1876 KB |
Output is correct |
5 |
Correct |
93 ms |
8796 KB |
Output is correct |
6 |
Incorrect |
102 ms |
8804 KB |
1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000' |
7 |
Halted |
0 ms |
0 KB |
- |