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

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter17: Markov Chains
Section: Chapter Questions
Problem 4RP
icon
Related questions
Question

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≤ai,bi≤n), indicating that understudies computer based intelligence and bi are associates. It's ensured, that ai≠bi, and that no (unordered) pair is referenced more than once. 

 

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

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Bellman operator
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole