#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e18//change to const int INF=1e18 if causing problem
const ll MOD=998244353;
const ll alt=1e10;
const ll inf=1e9+7;//Precalc is not a bad idea
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define mod(a) (a+inf)%inf
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#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;
ll 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];
}
for(int i=3;i<=n;i++){
dp[i][0]+=max({dp[i-2][0],dp[i-2][1],dp[i-3][0],dp[i-3][1]});
dp[i][1]+=dp[i-1][0];
}
return max({dp[n][0],dp[n-1][0],dp[n-1][1]});
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
3560 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1748 KB |
Output is correct |
2 |
Correct |
1 ms |
1748 KB |
Output is correct |
3 |
Correct |
15 ms |
2872 KB |
Output is correct |
4 |
Correct |
12 ms |
2968 KB |
Output is correct |
5 |
Correct |
27 ms |
4304 KB |
Output is correct |
6 |
Correct |
25 ms |
4460 KB |
Output is correct |
7 |
Correct |
29 ms |
4388 KB |
Output is correct |
8 |
Correct |
27 ms |
4380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1748 KB |
Output is correct |
2 |
Correct |
1 ms |
1748 KB |
Output is correct |
3 |
Correct |
15 ms |
2872 KB |
Output is correct |
4 |
Correct |
12 ms |
2968 KB |
Output is correct |
5 |
Correct |
27 ms |
4304 KB |
Output is correct |
6 |
Correct |
25 ms |
4460 KB |
Output is correct |
7 |
Correct |
29 ms |
4388 KB |
Output is correct |
8 |
Correct |
27 ms |
4380 KB |
Output is correct |
9 |
Incorrect |
26 ms |
4220 KB |
1st lines differ - on the 1st token, expected: '99999', found: '66666' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
3560 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |