이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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]=dp[i-1][0];
}
return max(dp[N-1][0],dp[N-1][1]);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |