#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
long long max_weights(int N, int M, vector<int> X, vector<int> Y,vector<int> w) {
map<int,long long> W;
for(int i=0;i<M;i++) W[X[i]]=w[i];
long long dp[N+5]{0};
dp[N-1]=0;
dp[N-2] = max(W[N-1],W[N-2]);
for(int i=N-3;i>=0;i--){
long long a=-1;
if(i<N-3)a=W[i+1]+W[i+2]+dp[i+4];
dp[i]=max({dp[i+1],a,W[i]+dp[i+2]});
}
return dp[0];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
56 ms |
8396 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 |
43 ms |
7208 KB |
Output is correct |
2 |
Correct |
39 ms |
7244 KB |
Output is correct |
3 |
Incorrect |
50 ms |
7872 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '18514616668874' |
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 |
43 ms |
7208 KB |
Output is correct |
2 |
Correct |
39 ms |
7244 KB |
Output is correct |
3 |
Incorrect |
50 ms |
7872 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '18514616668874' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
56 ms |
8396 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |