CF272E.Dima and Horses

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Dima came to the horse land. There are nn horses living in the land. Each horse in the horse land has several enemies (enmity is a symmetric relationship). The horse land isn't very hostile, so the number of enemies of each horse is at most 3.

Right now the horse land is going through an election campaign. So the horses trusted Dima to split them into two parts. At that the horses want the following condition to hold: a horse shouldn't have more than one enemy in its party.

Help Dima split the horses into parties. Note that one of the parties can turn out to be empty.

输入格式

The first line contains two integers n,mn,m — the number of horses in the horse land and the number of enemy pairs.

Next mm lines define the enemy pairs. The ii -th line contains integers ai,bia_{i},b_{i} (1<=ai,bi<=n; aibi)(1<=a_{i},b_{i}<=n; a_{i}≠b_{i}) , which mean that horse aia_{i} is the enemy of horse bib_{i} .

Consider the horses indexed in some way from 1 to nn . It is guaranteed that each horse has at most three enemies. No pair of enemies occurs more than once in the input.

输出格式

Print a line, consisting of nn characters: the ii -th character of the line must equal "0", if the horse number ii needs to go to the first party, otherwise this character should equal "1".

If there isn't a way to divide the horses as required, print -1.

输入输出样例

  • 输入#1

    3 3
    1 2
    3 2
    3 1
    

    输出#1

    100
    
  • 输入#2

    2 1
    2 1
    

    输出#2

    00
    
  • 输入#3

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

    输出#3

    0110000000
    
首页