#include "fish.h"
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define pll pair<ll,ll>
using namespace std;
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) {
vector<ll> fish(N,0);
vector<vector<ll>> dp(N,vector<ll>(2));
ll i;
for(i=0;i<M;i++){
fish[X[i]]=W[i];
}
dp[0][0]=dp[0][1]=0;
dp[1][0]=fish[1];dp[1][1]=fish[0];
for(i=2;i<N;i++){
dp[i][0]=max(dp[i-1][1]+fish[i],dp[i-1][0]);
dp[i][1]=max({dp[i-2][0]+fish[i-1],dp[i-1][0],dp[i-1][1]});
}
return max(dp[N-1][0],dp[N-1][1]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
7756 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 |
5 ms |
6484 KB |
Output is correct |
2 |
Correct |
6 ms |
6484 KB |
Output is correct |
3 |
Correct |
17 ms |
7100 KB |
Output is correct |
4 |
Correct |
14 ms |
7992 KB |
Output is correct |
5 |
Correct |
28 ms |
10416 KB |
Output is correct |
6 |
Correct |
23 ms |
9780 KB |
Output is correct |
7 |
Correct |
27 ms |
10464 KB |
Output is correct |
8 |
Correct |
27 ms |
10412 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
5 ms |
6484 KB |
Output is correct |
2 |
Correct |
6 ms |
6484 KB |
Output is correct |
3 |
Correct |
17 ms |
7100 KB |
Output is correct |
4 |
Correct |
14 ms |
7992 KB |
Output is correct |
5 |
Correct |
28 ms |
10416 KB |
Output is correct |
6 |
Correct |
23 ms |
9780 KB |
Output is correct |
7 |
Correct |
27 ms |
10464 KB |
Output is correct |
8 |
Correct |
27 ms |
10412 KB |
Output is correct |
9 |
Incorrect |
27 ms |
10176 KB |
1st lines differ - on the 1st token, expected: '99999', found: '66666' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
7756 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |