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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education