#2340. 找寻者

找寻者

找寻者

题目描述

找寻者 - Problem - QOJ.ac

Login

Register

QOJ.ac

QOJ

[QOJ](//qoj.ac)

Contests

Category

Problems

Submissions

Hack!

Blogs

Day 1

		Time Limit:			1.5 s		
			Memory Limit:			1024 MB		
			Total points:			100		
					
		Difficulty: 
		[show]

4

	Hackable ✓

				联合省选 2026 Day 1				

		A.
		找寻者		

	



[
	Statistics	](/contest/3493/problem/17301/statistics)





	[
		Statement		](#tab-statement)

			

[ Languages](#)


	[Default](/contest/3493/problem/17301/statement/default)
	

							[English](/contest/3493/problem/17301/statement/en)

Submit

Custom Test

Attachments

Discussions & Issues 1

Back to the contest

					**This problem is prepared by 

abruce .**

Submit

Run

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions

#1271EditorialOpen《找寻者》解题报告Anonymous2026-03-14 17:53:59View

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0

No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.

Do not submit duplicated issues.

Issues must be filed in English or Chinese only.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.

					 English					
				

				[العربية](//qoj.ac/contest/3493/problem/17301?locale=ar)
					[English](//qoj.ac/contest/3493/problem/17301?locale=en)
					[Español](//qoj.ac/contest/3493/problem/17301?locale=es)
					[Français](//qoj.ac/contest/3493/problem/17301?locale=fr)
					[日本語](//qoj.ac/contest/3493/problem/17301?locale=ja)
					[한국어](//qoj.ac/contest/3493/problem/17301?locale=ko)
						[Türkçe](//qoj.ac/contest/3493/problem/17301?locale=tr)
						[简体中文](//qoj.ac/contest/3493/problem/17301?locale=zh-cn)
					[繁體中文](//qoj.ac/contest/3493/problem/17301?locale=zh-tw)

QOJ.ac | QOJ 4.5.49 (2019-2026)

Made with ❤️ by Qingyu✨ | Contact us: [email protected]

Server Time: 2026-11-09 01:29:27 (UTC+8)

输入格式

(见题面原文)

输出格式

(见题面原文)

数据范围

(见题面原文)

样例

样例 1

0 2
5
1 2
1 3
2 4
2 5
8
1 2
1 3
2 4
2 5
2 6
5 7
3 8
665496238
549034400

样例 2

0 5
19
4 6
10 16
1 13
3 11
16 17
10 2
4 11
7 8
19 18
10 15
14 1
12 5
9 17
9 4
12 11
10 7
12 14
19 4
19
7 10
14 3
17 9
13 7
13 15
2 1
14 6
11 5
17 7
7 16
12 3
18 13
2 8
18 8
15 14
7 4
1 19
5 9
18
16 13
3 6
9 1
2 1
12 1
11 4
7 17
8 6
8 12
2 4
11 17
14 15
5 6
10 7
7 13
13 14
18 8
19
5 18
15 2
6 13
12 1
2 8
19 18
7 19
18 14
19 17
6 2
16 19
15 5
12 10
11 3
10 9
4 12
8 12
11 12
18
3 5
15 11
17 1
10 7
16 4
10 16
1 2
8 4
4 14
13 15
9 10
11 5
7 2
13 4
14 12
15 18
6 8
609523566
506130945
706163310
806422043
285617817