The chocolate rooms
Practice
3.1 (8 votes)
Approved
Basic programming
Basics of implementation
Easy
Grammar Verified
Implementation
Maps
Ready
Recruit
Sets
Problem
64% Success 5584 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Your task is to take some chocolates from \(N\) different rooms. Each room contains \(P_i\) number of chocolates of the same or different brands. You are given an integer \(K\).
Write a program to determine whether you can visit each room and find \(K\) different brands of chocolates.
Input format
- First line: \(T\) denoting the number of test cases
- For each test case:
- First line: Two space-separated integers \(N\) and \(K\)
- Next \(N\) lines: An integer \(P\) followed by \(P\) space-separated strings denoting the brands of the chocolates
Output format
For each test case, print \(Yes\) or \(No\) depending upon the result.
Constraints
\(1 \leq T \leq 5\)
\(1 \leq N \leq 10^2 \)
\( 1 \leq K \leq 10^3 \)
\( 1 \leq P_i \leq 10^2 \)
\( 1 \leq \) Length of the strings \( \leq 10 \)
Submissions
Please login to view your submissions
Similar Problems
Points:20
13 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation
Points:20
29 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation
Points:20
14 votes
Tags:
ApprovedEasyMathOpen
Editorial