#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 if (n<=2)
{
long long kaj_nula=0,kaj_eden=0;
for (int i=0;i<m;i++)
{
if (x[i]==0)
kaj_nula+=w[i];
else
kaj_eden+=w[i];
}
vk=max(kaj_nula,kaj_eden);
}
else
{
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
vk+=w[i],mat1[y[i]]=w[i];
}
for (int i=1;i<n;i++)
{
mat0[i]+=mat0[i-1];
mat1[i]+=mat1[i-1];
}
for (int i=0;i<n;i++)
vk=max(vk,vk+mat0[i]-mat1[i]);
}
return vk;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
3540 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '1814987461926477591' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
57 ms |
5396 KB |
1st lines differ - on the 1st token, expected: '40604614618209', found: '2277406829545780' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
1748 KB |
Output is correct |
3 |
Incorrect |
15 ms |
2900 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 |
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 |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
1748 KB |
Output is correct |
3 |
Incorrect |
15 ms |
2900 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 |
22 ms |
3540 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '1814987461926477591' |
2 |
Halted |
0 ms |
0 KB |
- |