#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W)
{
bool subtask1=true, subtask2=true/*, subtask3=true*/;
for(int i=0; i<M; i++)
{
if(X[i]%2!=0)subtask1=false;
if(X[i]>1)subtask2=false;
//if(Y[i]!=0)subtask3=false;
}
if(subtask1)
{
ll rez=0;
for(int i=0; i<M; i++)rez+=W[i];
return rez;
}
if(subtask2)
{
ll s1=0, s0=0, m[N][2];
for(int i=0; i<M; i++)
{
if(X[i]==0)s0+=W[i];
else s1+=W[i];
m[Y[i]][X[i]]=W[i];
}
for(int i=0; i<N; i++)
{
m[i][0]=m[max(i-1, 0)][0]+m[i][0];
m[i][1]=m[max(i-1, 0)][1]+m[i][1];
}
if(N==2)return max(m[N-1][0], m[N-1][1]);
ll rez=0;
for(int i=0; i<N; i++)
{
rez=max(rez, m[i][0]+m[N-1][1]-m[i][0]);
}
return rez;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
3276 KB |
Output is correct |
2 |
Correct |
27 ms |
4092 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
90 ms |
11512 KB |
Output is correct |
6 |
Correct |
86 ms |
11560 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '2', found: '281462383946537' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '882019', found: '0' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
300 KB |
1st lines differ - on the 1st token, expected: '3', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
300 KB |
1st lines differ - on the 1st token, expected: '3', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
300 KB |
1st lines differ - on the 1st token, expected: '3', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '882019', found: '0' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
3276 KB |
Output is correct |
2 |
Correct |
27 ms |
4092 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
90 ms |
11512 KB |
Output is correct |
6 |
Correct |
86 ms |
11560 KB |
Output is correct |
7 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '2', found: '281462383946537' |
8 |
Halted |
0 ms |
0 KB |
- |