#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll ps1[100005], ps2[100005];
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) {
for (int i = 0; i < M; i++) {
if (X[i] == 0) ps1[Y[i]] += W[i];
else ps2[Y[i]] += W[i];
}
for (int i = 1; i < N; i++) ps1[i] += ps1[i-1];
for (int i = N-1; i >= 0; i--) ps2[i] += ps2[i+1];
ll ans = 0;
for (int i = 0; i < N; i++) ans = max(ans,ps1[i] + ps2[i+1]);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
3540 KB |
Output is correct |
2 |
Correct |
28 ms |
4184 KB |
Output is correct |
3 |
Correct |
2 ms |
1748 KB |
Output is correct |
4 |
Correct |
1 ms |
1748 KB |
Output is correct |
5 |
Incorrect |
83 ms |
8808 KB |
1st lines differ - on the 1st token, expected: '149814460735479', found: '149812258490032' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
48 ms |
5420 KB |
Output is correct |
3 |
Correct |
78 ms |
9712 KB |
Output is correct |
4 |
Correct |
29 ms |
4924 KB |
Output is correct |
5 |
Correct |
32 ms |
5952 KB |
Output is correct |
6 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '4044', found: '6066' |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1748 KB |
Output is correct |
2 |
Incorrect |
1 ms |
1748 KB |
1st lines differ - on the 1st token, expected: '882019', found: '0' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '4044', found: '6066' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '4044', found: '6066' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '4044', found: '6066' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1748 KB |
Output is correct |
2 |
Incorrect |
1 ms |
1748 KB |
1st lines differ - on the 1st token, expected: '882019', found: '0' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
3540 KB |
Output is correct |
2 |
Correct |
28 ms |
4184 KB |
Output is correct |
3 |
Correct |
2 ms |
1748 KB |
Output is correct |
4 |
Correct |
1 ms |
1748 KB |
Output is correct |
5 |
Incorrect |
83 ms |
8808 KB |
1st lines differ - on the 1st token, expected: '149814460735479', found: '149812258490032' |
6 |
Halted |
0 ms |
0 KB |
- |