Why cant we do it with a 1D array
int vacation_BU(int a[],int b[], int c[],int n){
int dp[10000];
dp[0] = max(a[0],max(b[0],c[0]));
char activity = a[0]>b[0] ? (a[0]>c[0] ? 'a' : 'c') : (b[0]>c[0] ? 'b' : 'c');
cout<<activity<<" ";
for(int i=1;i<n;i++){
if(activity=='a'){
dp[i] = dp[i-1] + max(b[i],c[i]);
activity = b[i] > c[i] ? 'b' : 'c';
}else if(activity == 'b'){
dp[i] = dp[i-1] + max(a[i],c[i]);
activity = a[i] > c[i] ? 'a' : 'c';
}else{
dp[i] = dp[i-1] + max(a[i],b[i]);
activity = a[i] > b[i] ? 'a' : 'b';
}
cout<<activity<<" ";
}
return dp[n-1];
}