#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int Max = 1e5 + 1;
ll qs[2][Max];
ll max_weights(int N, int M, vi X, vi Y, vi W) {
for (int i = 0; i < M; i++) {
qs[X[i]][Y[i] + 1] = W[i];
}
for (int i = 0; i < 2; i++) {
for (int j = 1; j <= N; j++) {
qs[i][j] += qs[i][j - 1];
}
}
if (N == 2) {
return max(qs[0][N], qs[1][N]);
}
ll total = 0;
for (int i = 0; i <= N; i++) {
total = max(total, qs[0][i] + qs[1][N] - qs[1][i]);
}
return total;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
3672 KB |
Output is correct |
2 |
Correct |
29 ms |
4184 KB |
Output is correct |
3 |
Correct |
2 ms |
1880 KB |
Output is correct |
4 |
Correct |
2 ms |
1884 KB |
Output is correct |
5 |
Runtime error |
78 ms |
14676 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
39 ms |
5436 KB |
Output is correct |
3 |
Correct |
47 ms |
10068 KB |
Output is correct |
4 |
Correct |
20 ms |
4944 KB |
Output is correct |
5 |
Correct |
25 ms |
5972 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 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
1884 KB |
Output is correct |
11 |
Correct |
1 ms |
1884 KB |
Output is correct |
12 |
Correct |
20 ms |
4956 KB |
Output is correct |
13 |
Correct |
24 ms |
5968 KB |
Output is correct |
14 |
Correct |
25 ms |
5088 KB |
Output is correct |
15 |
Correct |
24 ms |
5456 KB |
Output is correct |
16 |
Correct |
20 ms |
5104 KB |
Output is correct |
17 |
Correct |
23 ms |
5468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1880 KB |
Output is correct |
2 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1880 KB |
Output is correct |
2 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
3672 KB |
Output is correct |
2 |
Correct |
29 ms |
4184 KB |
Output is correct |
3 |
Correct |
2 ms |
1880 KB |
Output is correct |
4 |
Correct |
2 ms |
1884 KB |
Output is correct |
5 |
Runtime error |
78 ms |
14676 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |