CF1103C.Johnny Solving

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Today is tuesday, that means there is a dispute in JOHNNY SOLVING team again: they try to understand who is Johnny and who is Solving. That's why guys asked Umnik to help them. Umnik gave guys a connected graph with nn vertices without loops and multiedges, such that a degree of any vertex is at least 33 , and also he gave a number 1kn1 \leq k \leq n . Because Johnny is not too smart, he promised to find a simple path with length at least nk\frac{n}{k} in the graph. In reply, Solving promised to find kk simple by vertices cycles with representatives, such that:

  • Length of each cycle is at least 33 .
  • Length of each cycle is not divisible by 33 .
  • In each cycle must be a representative - vertex, which belongs only to this cycle among all printed cycles.

You need to help guys resolve the dispute, for that you need to find a solution for Johnny: a simple path with length at least nk\frac{n}{k} ( nn is not necessarily divided by kk ), or solution for Solving: kk cycles that satisfy all the conditions above. If there is no any solution - print 1-1 .

输入格式

The first line contains three integers nn , mm and kk ( 1kn2.5105,1m51051 \leq k \leq n \leq 2.5 \cdot 10^5, 1 \leq m \leq 5 \cdot 10^5 )

Next mm lines describe edges of the graph in format vv , uu ( 1v,un1 \leq v, u \leq n ). It's guaranteed that vuv \neq u and all mm pairs are distinct.

It's guaranteed that a degree of each vertex is at least 33 .

输出格式

Print PATH in the first line, if you solve problem for Johnny. In the second line print the number of vertices in the path cc ( cnkc \geq \frac{n}{k} ). And in the third line print vertices describing the path in route order.

Print CYCLES in the first line, if you solve problem for Solving. In the following lines describe exactly kk cycles in the following format: in the first line print the size of the cycle cc ( c3c \geq 3 ). In the second line print the cycle in route order. Also, the first vertex in the cycle must be a representative.

Print 1-1 if there is no any solution. The total amount of printed numbers in the output must be at most 10610^6 . It's guaranteed, that if exists any solution then there is a correct output satisfies this restriction.

输入输出样例

  • 输入#1

    4 6 2
    1 2
    1 3
    1 4
    2 3
    2 4
    3 4
    

    输出#1

    PATH
    4
    1 2 3 4 
  • 输入#2

    10 18 2
    1 2
    1 3
    1 4
    1 5
    1 6
    1 7
    1 8
    1 9
    1 10
    2 3
    3 4
    2 4
    5 6
    6 7
    5 7
    8 9
    9 10
    8 10
    

    输出#2

    CYCLES
    4
    4 1 2 3 
    4
    7 1 5 6 
    
首页