#include <fish.h>
#include <bits/stdc++.h>
#define MAX 200005
#define INF 1e12
#define ll long long
#define pii pair<int,int>
#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
vector<pair<ll,ll> > fish;
long long ans;
long long a1[100005] , a2[100005] , 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) a1[Y[i]+1] += W[i];
else a2[Y[i]+1] += W[i];
}
for (int i = 1; i <= N; i++) {
ps1[i] = ps1[i-1]+a1[i];
ps2[i] = ps2[i-1]+a2[i];
}
for (int i = 0; i <= N; i++) {
ans = max(ans , ps2[N]-ps2[i]+ps1[i]);
ans = max(ans , ps1[N]-ps1[i]+ps2[i]);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
4432 KB |
Output is correct |
2 |
Correct |
24 ms |
4956 KB |
Output is correct |
3 |
Correct |
1 ms |
2136 KB |
Output is correct |
4 |
Correct |
2 ms |
1880 KB |
Output is correct |
5 |
Correct |
72 ms |
9808 KB |
Output is correct |
6 |
Incorrect |
71 ms |
9808 KB |
1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000' |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
48 ms |
6996 KB |
Output is correct |
3 |
Incorrect |
49 ms |
11604 KB |
1st lines differ - on the 1st token, expected: '50032678213482', found: '50049263855627' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1880 KB |
Output is correct |
2 |
Correct |
2 ms |
2648 KB |
Output is correct |
3 |
Incorrect |
15 ms |
4088 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2392 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2392 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 |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2392 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2392 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 |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2392 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2392 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 |
1880 KB |
Output is correct |
2 |
Correct |
2 ms |
2648 KB |
Output is correct |
3 |
Incorrect |
15 ms |
4088 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
4432 KB |
Output is correct |
2 |
Correct |
24 ms |
4956 KB |
Output is correct |
3 |
Correct |
1 ms |
2136 KB |
Output is correct |
4 |
Correct |
2 ms |
1880 KB |
Output is correct |
5 |
Correct |
72 ms |
9808 KB |
Output is correct |
6 |
Incorrect |
71 ms |
9808 KB |
1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000' |
7 |
Halted |
0 ms |
0 KB |
- |