#include <bits/stdc++.h>
using namespace std;
long long max_weights(int n,int m,vector<int> x,vector<int> y,vector<int> w)
{
long long vk=0;
long long mat0[n]={0},mat1[n]={0};
for (int i=0;i<m;i++)
{
if (x[i]==0)
mat0[y[i]]=w[i];
else
mat1[y[i]]=w[i];
}
for (int i=1;i<n;i++)
{
mat0[i]+=mat0[i-1];
mat1[i]+=mat1[i-1];
}
if (n<=2)
vk=max(mat1[n-1],mat0[n-1]);
else
{
vk=mat1[n-1];
for (int i=0;i<n;i++)
vk=max(vk,mat1[n-1]+mat0[i]-mat1[i]);
}
return vk;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
3560 KB |
Output is correct |
2 |
Correct |
27 ms |
4176 KB |
Output is correct |
3 |
Correct |
2 ms |
1748 KB |
Output is correct |
4 |
Correct |
2 ms |
1748 KB |
Output is correct |
5 |
Incorrect |
93 ms |
8800 KB |
1st lines differ - on the 1st token, expected: '149814460735479', found: '49851995244248' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
48 ms |
5400 KB |
Output is correct |
3 |
Correct |
66 ms |
6484 KB |
Output is correct |
4 |
Correct |
33 ms |
3548 KB |
Output is correct |
5 |
Correct |
82 ms |
4160 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 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 |
1 ms |
1748 KB |
Output is correct |
11 |
Correct |
2 ms |
1748 KB |
Output is correct |
12 |
Correct |
26 ms |
3576 KB |
Output is correct |
13 |
Correct |
28 ms |
4192 KB |
Output is correct |
14 |
Correct |
23 ms |
3540 KB |
Output is correct |
15 |
Correct |
30 ms |
3924 KB |
Output is correct |
16 |
Correct |
27 ms |
3564 KB |
Output is correct |
17 |
Correct |
26 ms |
3928 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1748 KB |
Output is correct |
2 |
Correct |
2 ms |
1748 KB |
Output is correct |
3 |
Incorrect |
15 ms |
2860 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '774766749' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '2268305442' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '2268305442' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '2268305442' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1748 KB |
Output is correct |
2 |
Correct |
2 ms |
1748 KB |
Output is correct |
3 |
Incorrect |
15 ms |
2860 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '774766749' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
3560 KB |
Output is correct |
2 |
Correct |
27 ms |
4176 KB |
Output is correct |
3 |
Correct |
2 ms |
1748 KB |
Output is correct |
4 |
Correct |
2 ms |
1748 KB |
Output is correct |
5 |
Incorrect |
93 ms |
8800 KB |
1st lines differ - on the 1st token, expected: '149814460735479', found: '49851995244248' |
6 |
Halted |
0 ms |
0 KB |
- |