AMBIG  Words on graphs
Input
The input is a directed (multi)graph.
The first line gives the number of edges M and the number of nodes N (>=2). Then each edge is described by a line of the form "FROM TO LABEL". Nodes (FROM, TO) are numbers in the range 0.. N1 and labels are also numbers.
All numbers in the input are nonnegative integers <2000.
Output
Print "YES" if there are two distinct walks with the same labelling from node 0 to node 1, otherwise print "NO".
Example 1
Input:
4 4
0 2 0
0 3 0
2 1 1
3 1 2
Output:
NO
Example 2
Input:
10 9
0 2 0
2 1 0
2 3 0
3 4 0
4 2 0
2 5 0
5 6 0
6 7 0
7 8 0
8 2 0
Output:
YES
In this case the shortest labelling that appears on two walks is 0 repeated 10 times.
hide comments
:D:
20150228 21:28:25
The problem definitively needs a clarification. I'll try to write a formal description.


David ©tefan:
20141225 05:30:16
@ebd: "Repeated" edges are distinct edges, yes.


chipmunk:
20130818 02:12:42
Can there be this type of traversal for NODE!


Akshay Kumar:
20130712 18:03:52
Is the order of labelling required to be same or can the order be different?


Erik Lonèarek:
20121230 14:19:18
The picture he meant to provide:


Goran Zuzic:
20120507 18:15:34
I see a lot of people have some problem understanding the problem, so I'll clarify it the way I've seen it:


sava:
20120412 17:00:50
Do we have to pass all edges with same label???


NguyÃªn:
20120404 18:34:56
Is it possible that a walk contains repeated node?


Rita Cristian:
20120401 23:30:25
Last edit: 20120401 23:34:04 

Radu Grigore:
20120103 15:54:55
@ebd: "Repeated" edges are distinct edges, yes.

Added by:  Radu Grigore 
Date:  20090929 
Time limit:  0.116s0.599s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ERL GOSU NODEJS PERL6 VB.NET 
Resource:  S Even, On Information Lossless Automata of Finite Order, 1965 