understudies went to the primary gathering of the Berland SU programming course (n is even). All understudies will be partitioned into two gatherings. Each gathering will go to precisely one example every week during one of the five working days (Monday, Tuesday, Wednesday, Thursday and Friday), and the days picked for the gatherings

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 and detailed answer will be upvoted else downvoted. Output screenshot also required.

 

understudies went to the primary gathering of the Berland SU programming course (n is even). All understudies will be partitioned into two gatherings. Each gathering will go to precisely one example every week during one of the five working days (Monday, Tuesday, Wednesday, Thursday and Friday), and the days picked for the gatherings should be unique. Besides, the two gatherings ought to contain similar number of understudies. 

 

Every understudy has filled an overview where they told which days of the week are advantageous for them to go to an illustration, and which are not. 

 

Your assignment is to decide whether it is feasible to pick two unique week days to plan the examples for the gathering (the main gathering will go to the illustration on the primary picked day, the subsequent gathering will go to the example on the second picked day), and gap the understudies into two gatherings, so the gatherings have equivalent sizes, and for every understudy, the picked illustration day for their gathering is advantageous. 

Input : The primary line contains a solitary integer t (1≤t≤104) — the number of testcases. Then, at that point, the portrayals of t testcases follow. The primary line of each testcase contains one integer n (2≤n≤1000) — the number of understudies. 

The I-th of the following n lines contains 5 integers, every one of them is 0 or 1. Assuming the j-th integer is 1, the I-th understudy can go to the examples on the j-th day of the week. In the event that the j-th integer is 0, the I-th understudy can't go to the illustrations on the j-th day of the week. Extra requirements on the input: for every understudy, somewhere around one of the times of the week is advantageous, the absolute number of understudies over all testcases doesn't surpass 105. 

Output :For each testcase print a reply. In case it's feasible to partition the understudies into two gatherings of equivalent sizes and pick various days for the gatherings so every understudy can go to the illustration in the picked day of their gathering, print "YES" (without quotes). In any case, print "NO" (without quotes).

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
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