#P4305. [JLOI2011] 不重复数字

    ID: 3240 远端评测题 1500ms 125MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>2011各省省选吉林O2优化排序哈希,HASH

[JLOI2011] 不重复数字

Description

Given nn numbers, remove the duplicates and keep only the first occurrence of each number.

Input Format

This problem contains multiple test cases.

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

For each test case:

The first line contains an integer nn.

The second line contains nn numbers, which are the given numbers.

Output Format

For each test case, output one line containing the remaining numbers after deduplication, separated by a single space.

2
11
1 2 18 3 3 19 2 3 6 5 4
6
1 2 3 4 5 6

1 2 18 3 19 6 5 4
1 2 3 4 5 6

Hint

For 30%30\% of the testdata, n100n \le 100, and each given number [0,100]\in [0, 100].

For 60%60\% of the testdata, n104n \le 10^4, and each given number [0,104]\in [0, 10^4].

For 100%100\% of the testdata, 1T501 \le T \le 50, 1n5×1041 \le n \le 5 \times 10^4, and each given number is within the 3232-bit signed integer range.

Translated by ChatGPT 5