#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W){
vector<ll> pa(N, 0ll), pb(N+1, 0ll);
for (int i=0; i<N; i++){
if (X[i] % 2) pb[Y[i]] += W[i];
else pa[Y[i]] += W[i];
}
ll bsf = 0;
for (int i=0; i<N; i++){
if (i != 0){
pa[i] += pa[i-1];
pb[i] += pb[i-1];
}
bsf = max(bsf, pa[i]-pb[i]);
}
return pb[N-1] + bsf;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
16 ms |
7256 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
29 ms |
5468 KB |
1st lines differ - on the 1st token, expected: '40604614618209', found: '22508241427227' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
3672 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
3672 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
16 ms |
7256 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |