logo AlgoBeat OnlineJudge
登录 注册

#216985. [ICPC 2025 Shanghai R] Hamu

内存限制:1024 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Dingdong plans to travel to the country of Hamu.

The country of Hamu consists of cities and bidirectional roads. Before this trip, Dingdong has already visited city exactly times. During this trip, Dingdong plans to enter Hamu at city . On each subsequent day, Dingdong will travel along a certain road to a city and visit that city once. At the end of the final day’s visit, Dingdong should be at city and leave Hamu from city . Note that on the day of entering the country of Hamu, Dingdong does not visit city .

Dingdong hopes that after this trip, combined with his previous visits, every city in Hamu will have been visited by him an even number of times. Dingdong has limited time and can visit at most cities during this trip. Please help him construct a valid trip plan, or tell him if it is impossible.

输入格式

The input contains multiple testcases. The first line of the input contains an integer (), the number of testcases.

For each testcase, the first line contains three integers (), where is the number of cities, is the number of roads, is the index of the starting city.

The next line contains integers (), the number of times Dingdong has visited for each city.

The next lines each contain two integers (), indicating an undirected road connecting city and city . There can be multiple edges and self loops. In other words, it’s not guaranteed that , and it’s not guaranteed that for .

It’s guaranteed that the sum of and the sum of over all testcases does not exceed , respectively.

输出格式

For each testcase, if there’s no valid trip plan, print No in a single line.

Otherwise, print Yes in a single line first, then print an integer () in the next line, representing the total number of visits during this trip. In the following line, print the indexes of the cities visited in order.

样例

样例输入 1

5
4 4 1
1 1 1 1
1 2
2 3
3 4
4 1
5 7 1
9 4 3 11 7
1 2
2 5
2 4
3 4
2 3
1 3
4 5
2 2 2
114 514
1 2
1 2
5 0 1
114 514 19 19 810
2 1 1
3 5
1 2

样例输出 1

Yes
4
2 3 4 1
Yes
6
2 4 5 2 3 1
Yes
0

No
Yes
2
2 1

数据范围与提示

For the first testcase, after visiting along the route , cities have been visited times respectively, meeting the requirement.