#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> psum_0(N+1, 0), psum_1(N+1, 0);
for (int i = 0 ; i < M ; i++) {
if (X[i] == 0) psum_0[Y[i]+1] += W[i];
if (X[i] == 1) psum_1[Y[i]+1] += W[i];
}
for (int i = 1 ; i <= N ; i++) {
psum_0[i] += psum_0[i-1];
psum_1[i] += psum_1[i-1];
}
long long ret = psum_1[N];
for (int i = 0 ; i <= N ; i++) {
long long val = psum_0[i];
if (N > 2) val += (psum_1[N] - psum_1[i]);
ret = max(ret, val);
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
3540 KB |
Output is correct |
2 |
Correct |
30 ms |
4180 KB |
Output is correct |
3 |
Correct |
2 ms |
1876 KB |
Output is correct |
4 |
Correct |
2 ms |
1748 KB |
Output is correct |
5 |
Incorrect |
93 ms |
8804 KB |
1st lines differ - on the 1st token, expected: '149814460735479', found: '0' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
55 ms |
5396 KB |
Output is correct |
3 |
Correct |
88 ms |
9924 KB |
Output is correct |
4 |
Correct |
34 ms |
4944 KB |
Output is correct |
5 |
Correct |
36 ms |
5932 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
3 ms |
1876 KB |
Output is correct |
11 |
Correct |
3 ms |
1876 KB |
Output is correct |
12 |
Correct |
31 ms |
4952 KB |
Output is correct |
13 |
Correct |
35 ms |
5932 KB |
Output is correct |
14 |
Correct |
25 ms |
4960 KB |
Output is correct |
15 |
Correct |
31 ms |
5456 KB |
Output is correct |
16 |
Correct |
28 ms |
4960 KB |
Output is correct |
17 |
Correct |
30 ms |
5456 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
1748 KB |
Output is correct |
2 |
Incorrect |
2 ms |
1876 KB |
1st lines differ - on the 1st token, expected: '882019', found: '0' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
1748 KB |
Output is correct |
2 |
Incorrect |
2 ms |
1876 KB |
1st lines differ - on the 1st token, expected: '882019', found: '0' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
3540 KB |
Output is correct |
2 |
Correct |
30 ms |
4180 KB |
Output is correct |
3 |
Correct |
2 ms |
1876 KB |
Output is correct |
4 |
Correct |
2 ms |
1748 KB |
Output is correct |
5 |
Incorrect |
93 ms |
8804 KB |
1st lines differ - on the 1st token, expected: '149814460735479', found: '0' |
6 |
Halted |
0 ms |
0 KB |
- |