#K67957. Unique File Names Across Folders
Unique File Names Across Folders
Unique File Names Across Folders
You are given T test cases. For each test case, you are provided with a number of folders. Each folder contains a certain number of files with their file names.
Your task is to determine whether all file names in a test case are unique across all folders. Output YES
if they are unique, and NO
otherwise.
Formally, for each test case, let \(F\) be the set of all file names. We need to check if \(\forall f_i, f_j \in F,\; i \neq j \implies f_i \neq f_j\). That is, no file name appears more than once.
inputFormat
The input is read from standard input (stdin) and has the following format:
T A_1 N_1 file1 file2 ... fileN_1 N_2 file1 file2 ... fileN_2 ... A_2 ...
Here:
T
is the number of test cases.- For each test case, the first line contains an integer
A
, representing the number of folders. - Then for each folder, there is an integer
N
indicating the number of files in that folder followed by a line withN
file names separated by spaces.
outputFormat
For each test case, output on a new line YES
if all file names are unique across the folders within that test case; otherwise, output NO
.
The output is printed to standard output (stdout).
## sample2
2
3
file1 file2 file3
2
file4 file5
3
2
file1 file2
2
file2 file3
1
file4
YES
NO
</p>