new scholarly year has begun, and Berland's college has n first-year understudies. They are separated into k scholarly gatherings, in any case, a portion of the gatherings may be vacant. Among the understudies, there are m sets of associates, and every colleague pair may be both in a typical gathering or be in two unique gatherings. Alice is the custodian of the primary years, she needs to have
Correct answer will be upvoted else Multiple Downvoted. Don't submit random answer. Computer science.
The new scholarly year has begun, and Berland's college has n first-year understudies. They are separated into k scholarly gatherings, in any case, a portion of the gatherings may be vacant. Among the understudies, there are m sets of associates, and every colleague pair may be both in a typical gathering or be in two unique gatherings.
Alice is the custodian of the primary years, she needs to have an engaging game to make everybody know one another. To do that, she will choose two unique scholastic gatherings and afterward partition the understudies of those gatherings into two groups. The game requires that there are no colleague sets inside every one of the groups.
Alice thinks about the number of sets of gatherings she can choose, with the end goal that it'll be feasible to play a game after that. All understudies of the two chose bunches should participate in the game.
Kindly note, that the groups Alice will shape for the game don't have to correspond with bunches the understudies learn in. Also, groups might have various sizes (or even be vacant).
Input
The main line contains three integers n, m and k (1≤n≤500000; 0≤m≤500000; 2≤k≤500000) — the number of understudies, the number of sets of colleagues and the number of gatherings individually.
The subsequent line contains n integers c1,c2,… ,cn (1≤ci≤k), where ci equivalents to the gathering number of the I-th understudy.
Next m lines follow. The I-th of them contains two integers man-made intelligence and bi (1≤
Output
Print a solitary integer — the number of ways of picking two unique gatherings to such an extent that it's feasible to choose two groups to play the game
Step by step
Solved in 4 steps with 1 images