#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define double long double
#define endl '\n'
#define sz(a) (int)a.size()
#define pb push_back
#define fs first
#define sc second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
ll const INF = LONG_LONG_MAX;
long long max_weights(int n, int m, std::vector<int> x, std::vector<int> y, std::vector<int> w)
{
vector<ll> val(n+3, 0);
for(int i=0;i<m;i++)
val[x[i]]=w[i];
vector<vector<ll>> dp(n+3, vector<ll>(3, 0));
dp[0][1]=val[1];
for(int i=1;i<n;i++)
{
dp[i][0]=max(dp[i-1][0], dp[i-1][1]);
dp[i][1]=val[i+1];
if(i==1){dp[i][1]+=max(dp[i-1][0]+val[i-1], dp[i-1][1]-val[i]);}
else
{
dp[i][1]+=max(dp[i-2][0]+val[i-1], max(dp[i-2][1], dp[i-1][1]-val[i]));
}
}
return max(dp[n-1][0], dp[n-1][1]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 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 |
9 ms |
6484 KB |
Output is correct |
2 |
Correct |
8 ms |
6484 KB |
Output is correct |
3 |
Correct |
22 ms |
7120 KB |
Output is correct |
4 |
Correct |
17 ms |
8016 KB |
Output is correct |
5 |
Correct |
37 ms |
10424 KB |
Output is correct |
6 |
Correct |
33 ms |
9856 KB |
Output is correct |
7 |
Correct |
31 ms |
10420 KB |
Output is correct |
8 |
Correct |
32 ms |
10408 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 |
9 ms |
6484 KB |
Output is correct |
2 |
Correct |
8 ms |
6484 KB |
Output is correct |
3 |
Correct |
22 ms |
7120 KB |
Output is correct |
4 |
Correct |
17 ms |
8016 KB |
Output is correct |
5 |
Correct |
37 ms |
10424 KB |
Output is correct |
6 |
Correct |
33 ms |
9856 KB |
Output is correct |
7 |
Correct |
31 ms |
10420 KB |
Output is correct |
8 |
Correct |
32 ms |
10408 KB |
Output is correct |
9 |
Incorrect |
34 ms |
10160 KB |
1st lines differ - on the 1st token, expected: '99999', found: '66666' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
7756 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |