#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<M; 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 |
Correct |
17 ms |
3676 KB |
Output is correct |
2 |
Correct |
17 ms |
4188 KB |
Output is correct |
3 |
Correct |
1 ms |
1884 KB |
Output is correct |
4 |
Correct |
1 ms |
1884 KB |
Output is correct |
5 |
Incorrect |
72 ms |
8800 KB |
1st lines differ - on the 1st token, expected: '149814460735479', found: '49851995244248' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
39 ms |
5404 KB |
Output is correct |
3 |
Correct |
37 ms |
8876 KB |
Output is correct |
4 |
Correct |
18 ms |
4688 KB |
Output is correct |
5 |
Correct |
18 ms |
5460 KB |
Output is correct |
6 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '4044', found: '6066' |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1884 KB |
Output is correct |
2 |
Correct |
1 ms |
1884 KB |
Output is correct |
3 |
Incorrect |
10 ms |
2908 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '774766749' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1884 KB |
Output is correct |
2 |
Correct |
1 ms |
1884 KB |
Output is correct |
3 |
Incorrect |
10 ms |
2908 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '774766749' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
3676 KB |
Output is correct |
2 |
Correct |
17 ms |
4188 KB |
Output is correct |
3 |
Correct |
1 ms |
1884 KB |
Output is correct |
4 |
Correct |
1 ms |
1884 KB |
Output is correct |
5 |
Incorrect |
72 ms |
8800 KB |
1st lines differ - on the 1st token, expected: '149814460735479', found: '49851995244248' |
6 |
Halted |
0 ms |
0 KB |
- |