1 solutions
-
0
C++ :
#include<stdio.h> #include<iostream> #include<algorithm> #include<string.h> using namespace std; int dp[100010][12]; int main() { int x,t,n; while(~scanf("%d",&n)&&n) { memset(dp,0,sizeof(dp)); int i,j,k; int maxn=0; for(i=0;i<n;i++) { scanf("%d %d",&x,&t); dp[t][x]++; maxn=max(maxn,t); } for(i=maxn-1;i>=0;i--) { for(j=0;j<=10;j++) dp[i][j]+=max(dp[i+1][j],max(dp[i+1][j+1],dp[i+1][j-1])); } printf("%d\n",dp[0][5]); } return 0; }
- 1
Information
- ID
- 744
- Time
- 1000ms
- Memory
- 64MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By