CF1423N.BubbleSquare Tokens

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

BubbleSquare social network is celebrating 13th13^{th} anniversary and it is rewarding its members with special edition BubbleSquare tokens. Every member receives one personal token. Also, two additional tokens are awarded to each member for every friend they have on the network. Yet, there is a twist – everyone should end up with different number of tokens from all their friends. Each member may return one received token. Also, each two friends may agree to each return one or two tokens they have obtained on behalf of their friendship.

输入格式

First line of input contains two integer numbers nn and kk ( 22 \leq nn \leq 1250012500 , 11 \leq kk \leq 10000001000000 ) - number of members in network and number of friendships.

Next kk lines contain two integer numbers aia_i and bib_i ( 11 \leq aia_i , bib_i \leq nn , aia_i \neq bib_i ) - meaning members aia_i and bib_i are friends.

输出格式

First line of output should specify the number of members who are keeping their personal token.

The second line should contain space separated list of members who are keeping their personal token.

Each of the following kk lines should contain three space separated numbers, representing friend pairs and number of tokens each of them gets on behalf of their friendship.

输入输出样例

  • 输入#1

    2 1
    1 2

    输出#1

    1
    1 
    1 2 0
  • 输入#2

    3 3
    1 2
    1 3
    2 3

    输出#2

    0
    1 2 0
    2 3 1
    1 3 2

说明/提示

In the first test case, only the first member will keep its personal token and no tokens will be awarded for friendship between the first and the second member.

In the second test case, none of the members will keep their personal token. The first member will receive two tokens (for friendship with the third member), the second member will receive one token (for friendship with the third member) and the third member will receive three tokens (for friendships with the first and the second member).

首页