A. 「一本通 2.3 例 1」Phone List

    Type: Default 1000ms 256MiB

「一本通 2.3 例 1」Phone List

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Description

Original source: POJ 3630

Given nn digit strings, each with a length not exceeding 1010, determine whether there exist two strings SS and TT such that SS is a prefix of TT. Multiple test cases are provided.

Input Format

The first line contains an integer TT, representing the number of test cases.

For each test case, the first line contains an integer nn, followed by nn lines each containing a digit string.

Output Format

For each test case, if there exist two digit strings SS and TT such that SS is a prefix of TT, output NO; otherwise, output YES.

Please note the correspondence between the result and the output here!

Sample 1

2
3
911
97625999
91125426
5
113
12340
123440
12345
98346

NO
YES

Constraints and Hints

For 100%100\% of the data, 1T401\le T\le 40, and 1n1041\le n \le 10^4.

20251130 D班作业(8)

Not Claimed
Status
Done
Problem
4
Open Since
2025-11-30 0:00
Deadline
2025-12-15 23:59
Extension
24 hour(s)