poorly with one another. There are m1 sets of first courses and second courses that go poorly with one another, m2 sets of second courses and beverages, and m3 sets of beverages and pastries that turn out poorly with one another. Ivan needs to purchase precisely one first course, one second course, one beverage, and one pastry so they work out in a good way for one another, and the absolute expense of the supper is the base

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Correct answer will be upvoted else downvoted. Computer science.    few dishes go poorly with one another. There are m1 sets of first courses and second courses that go poorly with one another, m2 sets of second courses and beverages, and m3 sets of beverages and pastries that turn out poorly with one another. Ivan needs to purchase precisely one first course, one second course, one beverage, and one pastry so they work out in a good way for one another, and the absolute expense of the supper is the base conceivable. Assist him with tracking down the least expensive supper choice! Input The primary line contains four integers n1, n2, n3 and n4 (1≤ni≤150000) — the number of kinds of first courses, second courses, beverages and treats, individually. Then, at that point, four lines follow. The primary line contains n1 integers a1,a2,… ,an1 (1≤ai≤108), where simulated intelligence is the expense of the I-th kind of first course. Three next lines indicate the expenses of second courses, beverages, and pastries similarly (1≤bi,ci,di≤108). The following line contains one integer m1 (0≤m1≤200000) — the number of sets of first and second courses that go poorly with one another. Every one of the following m1 lines contains two integers xi and yi (1≤xi≤n1; 1≤yi≤n2) meaning that the primary course number xi goes poorly with the subsequent course number yi. This load of sets are unique. The square of sets of second dishes and beverages that go poorly with one another is given in a similar configuration. The equivalent for sets of beverages and pastries that go poorly with one another (0≤m2,m3≤200000). Output In case it's difficult to pick a first course, a subsequent course, a beverage, and a pastry so they work out in a good way for one another, print −1. In any case, print one integer — the base absolute expense of the supper.
Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY