atcoder#ARC143D. [ARC143D] Bridges
[ARC143D] Bridges
Score : points
Problem Statement
We have two sequences and consisting of intgers between and (inclusive).
For a string of length consisting of 0
and 1
, consider the following undirected graph with vertices and edges corresponding to that string.
- If the -th character of the string is
0
, the -th edge connects Vertex and Vertex . - If the -th character of the string is
1
, the -th edge connects Vertex and Vertex . - The -th edge connects Vertex and Vertex .
Here, and are integers such that and , and the vertices are numbered to .
Find one string of length consisting of 0
and 1
such that the corresponding undirected graph has the minimum number of bridges.
Notes on bridges
Constraints
Input
Input is given from Standard Input in the following format:
Output
Print one string that satisfies the requirement. If there are multiple such strings, you may print any of them.
2 2
1 1
2 2
01
The graph corresponding to 01
has no bridges.
In the graph corresponding to 00
, the edge connecting Vertex and Vertex and the edge connecting Vertex and Vertex are bridges, so 00
does not satisfy the requirement.
6 7
1 1 2 3 4 4 5
2 3 3 4 5 6 6
0100010