Welcome, Guest! Sign Up RSS

Clever Space

Friday, 11.22.2024
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);
}

Views: 328 | Added by: dhy0077 | Rating: 0.0/0
Total comments: 0
Only registered users can add comments.
[ Sign Up | Login ]