#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){
ll x = 0;
vector<ll> pa(N, 0ll), pb(N, 0ll);
for (int i=0; i<N; i++){
if (X[i] == 1){
pb[Y[i]] = (ll) W[i];
x += W[i];
}
else pa[Y[i]] = (ll) W[i];
}
ll bsf = 0;
for (int i=1; i<N; i++){
pa[i] += pa[i-1];
pb[i] += pb[i-1];
}
for (int i=0; i<N; i++){
bsf = max((ll) bsf, (ll) pa[i]-pb[i]);
}
return x + bsf;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
16 ms |
7260 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: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
3676 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '3', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '3', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '3', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
3676 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
16 ms |
7260 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |