playing one more roguelike PC game. He controls a solitary saint in the game. The saint has n gear openings. There is a rundown of ci things for the I-th opening, the j-th of them expands the saint strength by ai,j. The things for each opening are pairwise particular and are recorded in the expanding request of their solidarity increment. Thus, ai,1

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 only else downvoted

 

 

Ivan is playing one more roguelike PC game. He controls a solitary saint in the game. The saint has n gear openings. There is a rundown of ci things for the I-th opening, the j-th of them expands the saint strength by ai,j. The things for each opening are pairwise particular and are recorded in the expanding request of their solidarity increment. Thus, ai,1<ai,2<⋯<ai,ci. 

For each opening Ivan picks precisely one thing. Let the picked thing for the I-th opening be the bi-th thing in the comparing list. The arrangement of decisions [b1,b2,… ,bn] is known as a form. The strength of a form is the amount of the strength increments of the things in it. A few forms are restricted from the game. There is a rundown of m pairwise particular prohibited forms. It's dependable that there's somewhere around one form that is not restricted. What is the develop with the greatest fortitude that isn't restricted from the game? In case there are various develops with greatest fortitude, print any of them. 

Input :The main line contains a solitary integer n (1≤n≤10) — the number of hardware openings. The I-th of the following n lines contains the depiction of the things for the I-th space. Initial, one integer ci (1≤ci≤2⋅105) — the number of things for the I-th opening. Then, at that point, ci integers ai,1,ai,2,… ,ai,ci (1≤ai,1<ai,2<⋯<ai,ci≤108). The amount of ci doesn't surpass 2⋅105. The following line contains a solitary integer m (0≤m≤105) — the number of prohibited forms. 

Every one of the following m lines contains a depiction of a restricted form — an arrangement of n integers b1,b2,… ,bn (1≤bi≤ci). The forms are pairwise particular, and there's somewhere around one form that is not restricted. 

Output : Print the develop with the greatest fortitude that isn't restricted from the game. In case there are different develops with most extreme fortitude, print any of them.

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