CF1239F.Swiper, no swiping!
NOI/NOI+/CTSC
通过率:0%
时间限制:2.00s
内存限制:512MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
I'm the Map, I'm the Map! I'm the MAP!!!
Map
In anticipation of new adventures Boots wanted to do a good deed. After discussion with the Map and Backpack, they decided to gift Dora a connected graph. After a long search, Boots chose t graph's variants, which Dora might like. However fox Swiper wants to spoil his plan.
The Swiper knows, that Dora now is only able to count up to 3, so he has came up with a following idea. He wants to steal some non-empty set of vertices, so that the Dora won't notice the loss. He has decided to steal some non-empty set of vertices, so that after deletion of the stolen vertices and edges adjacent to them, every remaining vertex wouldn't change it's degree modulo 3. The degree of a vertex is the number of edges it is adjacent to. It would've been suspicious to steal all the vertices, so Swiper needs another plan.
Boots are sure, that the crime can not be allowed. However they are afraid, that they won't be able to handle this alone. So Boots decided to ask for your help. Please determine for every graph's variant whether the Swiper can perform the theft or not.
我是地图!我是地图!我是地图!!!
地图
为了迎接新的冒险,小靴子(Boots)想做一件好事。在与地图(Map)和背包(Backpack)商议后,他们决定送给朵拉(Dora)一张连通图。经过长时间的搜寻,小靴子选出了 t 种朵拉可能喜欢的图的变体。然而,狐狸斯威珀(Swiper)却想破坏他的计划。
斯威珀知道,朵拉目前只会数到 3,因此他想出了如下主意:他打算偷走某个非空的顶点集合,使得朵拉不会察觉丢失了任何东西。他决定偷走某个非空的顶点集合,使得在删除这些被偷走的顶点以及所有与之关联的边之后,每个剩余顶点的度数对 3 取模的结果保持不变。一个顶点的度数是指与其相邻的边的数量。若偷走全部顶点,则过于明显,因此斯威珀需要另一个方案。
小靴子坚信,这种犯罪行为绝不能被允许。但他们又担心单凭自己无法应对。因此,小靴子决定向你求助。请判断对于每一种图的变体,斯威珀是否能够实施此次盗窃。
输入格式
The first line contains a single integer t (1≤t≤100000) — the number of graph variants.
The first line of each variant contains integers n, m (1≤n≤500000, 0≤m≤500000), the number of vertexes and edges in the graph.
Then m lines follow, each containing integers ai, bi (1≤ai,bi≤n), the indices of the vertices connected with a corresponding edge.
It's guaranteed, that the graph is connected and doesn't contain multiple edges or self-loops.
It's guaranteed, that the sum of n over all variants is at most 500000 and that the sum of m over all variants is at most 500000.
Descriptions of graph's variants are separated with an empty line.
第一行包含一个整数 t(1≤t≤100000),表示图的变体数量。
每个变体的第一行包含两个整数 n、m(1≤n≤500000,0≤m≤500000),分别表示图中顶点和边的数量。
接下来是 m 行,每行包含两个整数 ai、bi(1≤ai,bi≤n),表示与对应边相连的两个顶点的编号。
保证该图是连通的,且不包含重边或自环。
保证所有变体的 n 之和不超过 500000,且所有变体的 m 之和不超过 500000。
各图变体的描述之间以空行分隔。
输出格式
For each variant:
-
In case the answer exists, print "Yes" and then the answer itself.
The first line should contain an integer c (1<c<n), the number of vertices the Crook can steal, without Dora noticing the loss. On the next line print c distinct integers, the indices of the graph's vertices in arbitrary order.
-
Otherwise print "No".
In case there are several correct ways to steal the vertices, print any of them.
Please note, that it's not required to maximize the number of stolen vertices.
对于每种情况:
-
若答案存在,则输出“Yes”,然后输出答案本身。
第一行应包含一个整数 c(1<c<n),表示“骗子”可以窃取的顶点数量,且多拉不会察觉丢失。
下一行输出 c 个互不相同的整数,以任意顺序表示图中被窃取顶点的索引。 -
否则输出“No”。
若存在多种正确的窃取顶点方案,输出其中任意一种即可。
请注意,不要求最大化被窃取顶点的数量。
输入输出样例
输入#1
3 3 3 1 2 2 3 3 1 6 6 1 2 1 3 2 3 2 5 2 6 2 4 8 12 1 2 1 3 2 3 1 4 4 5 5 1 3 6 3 7 3 8 6 1 7 1 8 1
输出#1
No Yes 3 4 5 6 Yes 3 6 7 8
说明/提示
The picture below shows the third variant from the example test. The set of the vertices the Crook can steal is denoted with bold.

下图展示了示例测试中的第三种情况。Crook 能够窃取的顶点集合用粗体标出。

输入解题思路,AI测评打分。不知道怎么写?