A higher resolution is required to access the IDE
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
Goal
Monitoring trails (m-trails) can instantaneously detect single and dual link failures in optical communication networks. An m-trail is an optical light-path, i.e., a laser transmits a light beam on a given wavelength at the start nodeThe traversed links
At the photo detector for
Our task is to identify the failed links (at most two) from the alarm code vector for a given link code matrix.
Example:
M-trails:
The corresponding link code matrix:
m_0 m_1 m_2 l_0 1 0 0l_1 1 0 1l_2 1 1 0l_3 0 1 0l_4 1 1 1
Alarm code vector: 110
If there can be only single link failure, from the simultaneous failure of
Input
Line 1: An integer links for the number of optical links.
Line 2: An integer mtrails for the number of m-trails.
Line 3: An integer failures for the maximum number of failures.
Line 4: An mtrails-length strings containing zeros and ones for the alarm code vector.
Next links lines: An mtrails-length string containing zeros and ones for the link code matrix.
Line 2: An integer mtrails for the number of m-trails.
Line 3: An integer failures for the maximum number of failures.
Line 4: An mtrails-length strings containing zeros and ones for the alarm code vector.
Next links lines: An mtrails-length string containing zeros and ones for the link code matrix.
Output
Link identifier k of the single failed link l_k, or the identifiers of the dual failed links in ascending order separated with a space (links are numbered from 0 to links-1). If the failure cannot be unambiguously identified, return AMBIGUOUS .
Constraints
5 ≤ links ≤ 90
3 ≤ mtrails ≤ 20
1 ≤ failures ≤ 2
3 ≤ mtrails ≤ 20
1 ≤ failures ≤ 2
Example
Input
5 3 1 010 100 101 110 010 111
Output
3
A higher resolution is required to access the IDE