#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;
bool first=true;
for (int i=0;i<m;i++)
if (w[i]%2==1)
{
first=false;
break;
}
if (first)
{
for (int i=0;i<m;i++)
vk+=w[i];
}
else
{
long long mat[n][2];
memset(mat,0,sizeof(mat));
for (int i=0;i<m;i++)
{
if (x[i]==0)
mat[y[i]][0]=w[i];
else
vk+=w[i],mat[y[i]][1]=w[i];
}
for (int i=n-2;i>=0;i--)
{
mat[i][0]+=mat[i+1][0];
mat[i][1]+=mat[i+1][1];
vk=max(vk,vk+mat[i][0]-mat[i][1]);
}
}
return vk;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
3564 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '1813247399987899615' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
1748 KB |
Output is correct |
3 |
Incorrect |
15 ms |
2860 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 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
1748 KB |
Output is correct |
3 |
Incorrect |
15 ms |
2860 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 |
Incorrect |
25 ms |
3564 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '1813247399987899615' |
2 |
Halted |
0 ms |
0 KB |
- |