#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,std::vector<int> W) {
vector<long long>v_0,v_1;
v_0.assign(N,0);
v_1.assign(N,0);
for(int i=0;i<M;i++){
if(X[i]==0)
v_0[Y[i]]+=W[i];
else
v_1[Y[i]]+=W[i];
}
for(int i=1;i<N;i++){
v_0[i]+=v_0[i-1];
v_1[i]+=v_1[i-1];
}
if(N<=2)
return max(v_0[N-1],v_1[N-1]);
long long c=v_1[N-1];
for(int i=0;i<N;i++){
c=max(c,v_1[N-1]-v_1[i]+v_0[i]);
}
return c;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
4584 KB |
Output is correct |
2 |
Correct |
22 ms |
5204 KB |
Output is correct |
3 |
Correct |
2 ms |
1884 KB |
Output is correct |
4 |
Correct |
1 ms |
1976 KB |
Output is correct |
5 |
Correct |
58 ms |
12288 KB |
Output is correct |
6 |
Incorrect |
57 ms |
12388 KB |
1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000' |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
29 ms |
8352 KB |
Output is correct |
3 |
Correct |
67 ms |
9948 KB |
Output is correct |
4 |
Correct |
14 ms |
4956 KB |
Output is correct |
5 |
Correct |
19 ms |
6224 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
1884 KB |
Output is correct |
11 |
Correct |
1 ms |
1884 KB |
Output is correct |
12 |
Correct |
14 ms |
4956 KB |
Output is correct |
13 |
Correct |
18 ms |
6060 KB |
Output is correct |
14 |
Correct |
15 ms |
4956 KB |
Output is correct |
15 |
Correct |
19 ms |
5596 KB |
Output is correct |
16 |
Correct |
15 ms |
4956 KB |
Output is correct |
17 |
Correct |
16 ms |
5456 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1884 KB |
Output is correct |
2 |
Correct |
1 ms |
1884 KB |
Output is correct |
3 |
Incorrect |
10 ms |
3672 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
436 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Incorrect |
1 ms |
348 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
436 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Incorrect |
1 ms |
348 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
436 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Incorrect |
1 ms |
348 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046' |
10 |
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 |
3672 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
4584 KB |
Output is correct |
2 |
Correct |
22 ms |
5204 KB |
Output is correct |
3 |
Correct |
2 ms |
1884 KB |
Output is correct |
4 |
Correct |
1 ms |
1976 KB |
Output is correct |
5 |
Correct |
58 ms |
12288 KB |
Output is correct |
6 |
Incorrect |
57 ms |
12388 KB |
1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000' |
7 |
Halted |
0 ms |
0 KB |
- |