Main » 2013 September 29 » [NOIP2012模拟赛No.12]杂务
4:39 PM [NOIP2012模拟赛No.12]杂务 |
水题#include<cstdio> #include<cstdlib> #include<cstring> #include<set> #include<algorithm> #include<map> #include<vector> #include<queue> #include<iostream> #include<string> #include<cmath> #define N 100010 #define FOR(i,a,b) for(i=(a);i<=(b);i++) #define ROF(i,a,b) for(i=(a);i>=(b);i--) typedef long long LL; using namespace std; int dp[N]; int main() { int n,i,p,t,x; scanf("%d",&n); int ans=0; FOR(i,1,n) { scanf("%d %d",&p,&t); dp[p]=0; for (scanf("%d",&x);x>0;scanf("%d",&x)) dp[p]=max(dp[p],dp[x]); dp[p]+=t; ans=max(ans,dp[p]); } printf("%d\n",ans); } |
|
Total comments: 0 | |