#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
#define sz(a) a.size()
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W){
int n=N;
int dp[n+1][2];
for(int i=0;i<=n;i++){
dp[i][0]=0,dp[i][1]=0;
}
for(int i=0;i<M;i++){
dp[X[i]+1][0]=W[i];
dp[X[i]+1][1]=W[i];
}
dp[2][0]=max(dp[1][0],dp[2][0]);
dp[2][1]=max(dp[1][1],dp[2][1]);
for(int i=3;i<=n;i++){
dp[i][0]+=max(dp[i-2][0],dp[i-2][1]);
dp[i][1]+=dp[i-1][0];
}
return max(dp[n][0],max(dp[n-1][0],dp[n-1][1]));
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
26 ms |
3020 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
980 KB |
Output is correct |
2 |
Correct |
1 ms |
1064 KB |
Output is correct |
3 |
Incorrect |
17 ms |
2444 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '545663910' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
980 KB |
Output is correct |
2 |
Correct |
1 ms |
1064 KB |
Output is correct |
3 |
Incorrect |
17 ms |
2444 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '545663910' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
26 ms |
3020 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |