preblem - problem link

please help me to find out what I am doing wrong.

my submission

```
class Solution {
public:
int dp[1000000][3];
int findmax(int i, int t, vector<vector<int>>&events, int prev){
if(t==0||i>=events.size()) return 0;
if(dp[i][t]!=-1) return dp[i][t];
int mx = findmax(i+1,t,events,prev); // skip the current event
if(events[i][0]>prev){ // if we are able to attend the current then attend it
mx = max( mx, findmax(i+1,t-1,events,events[i][1]) + events[i][2] );
}
return dp[i][t] = mx;
}
int maxTwoEvents(vector<vector<int>>& events) {
int n = events.size();
vector<tuple<int,int,int>> tup;
for(int i=0;i<n;i++){
tup.push_back({events[i][0],events[i][1],events[i][2]});
}
sort(tup.begin(),tup.end());
for(int i=0;i<n;i++){
events[i][0] = get<0>(tup[i]);
events[i][1] = get<1>(tup[i]);
events[i][2] = get<2>(tup[i]);
}
memset(dp,-1,sizeof(dp));
int ans = findmax(0,2,events,-1);
return ans;
}
};
```