F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Stone game

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 233    Accepted Submission(s): 66


Problem Description
Birdstorm and hahaha are playing a game. Given a DAG (Directed acyclic graph) with n nodes and m edges. There are total k stones on the nodes and each node can contains more than one stone. Each turn, one can move at most two stones alone the edge, and he is lost if he can not move any one. Birdstorm move first and he wants to know how many ways to do his first operation that he can win the game.
 

Input
There are multiple test case. Each case begin with n(1<=n<=5000), m(1<=m<=100000), k(1<=k<=300). Next m lines, each lines contains two integers u, v, indicates an edge from u to v. Then a line with k numbers, indicates the position of the i-th stone.
 

Output
Each test case, print one line, the number of ways.
 

Sample Input
4 3 1 2 1 3 2 3 4 3
 

Sample Output
1
 

Author
BUPT
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 15:50:25, Gzip enabled