This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "fish.h"
#include<bits/stdc++.h>
using namespace std;
long long int max_weights(int N,int M,vector<int> x,vector<int> y,vector<int> w){
long long int dp[4]={0,0,0,0};
long long int tmp[4];
int Graph[N]={0};
for(int i=0;i<M;i++){
Graph[x[i]]=w[i];
}
dp[2]=Graph[0];
for(int i=1;i<N-1;i++){
tmp[0]=max(dp[0],dp[2]);
tmp[1]=max(dp[0],dp[2]);
tmp[2]=max(dp[1],dp[3])+Graph[i];
tmp[3]=max(dp[1]+Graph[i],dp[3]);
dp[0]=tmp[0];
dp[1]=tmp[1];
dp[2]=tmp[2];
dp[3]=tmp[3];
//cout<<dp[0]<<" "<<dp[1]<<" "<<dp[2]<<" "<<dp[3]<<endl;
}
dp[1]+=Graph[N-1];
return max(max(dp[0],dp[1]),max(dp[2],dp[3]));
}
# | 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... |