#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, 0ll);
for (int i=0; i<N; i++){
if (X[i] == 1) pb[Y[i]] = (ll) W[i];
else pa[Y[i]] = (ll) 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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
16 ms |
7256 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
3676 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '3', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '3', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '3', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
3676 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
16 ms |
7256 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |