the file CUVINTE.TXT contains words
in m lines:
In the file CUVINTE.TXT there will be words containing only
the allowed characters (the ones in DICTION.TXT).
from any crossing point of the route, the policeman
can patrol all its streets only one time, always returning to the leaving
in the end, every route given to a policeman must
have at least one street that is not being watched by the rest of the
n m // in the first line two numbers are written:
n (n <= 1500),representing the number of crossings in the city;
m (m <= 5000), representing the number of streets;
i11 i12 // the next m lines contain pairs of two
numbers, representing the identifiers of the crossings to which
each street is connected.
p // on the first line the maximum number of policemen that
can be sent "on the field"
t11 t12 ... t1k1
t21 t22 ... t2k2
// in the next p lines, the routes given to the policemen
will be written and for each route the crossings on it
... will be mentioned; the data in each line will be
separated by a space.
tp1 tp2 ... tpkp
1 2 6 1
2 3 6 2
3 6 5 4 3
3 5 4 3
"Ion Luca Caragiale" High School,
a system formed of n stages, n <=
an alphabet, made up of small characters in the
an initial stage;
a set of final stages;
a function that describes the evolution of the
stages in accordance with the characters introduced in the alphabet;
the file DICTION.TXT having the
n // the number of stages;
c1 c2 ... cr
// the characters of the alphabet, separated by space;
i // the number of the initial stage; 1 <= i <= n;
k1 k2 ... kl
s11 s12 ... s1i1
s21 s22 ... s2i2
s(n*r)1 s(n*r)2 ... s(n*r)i(n*r)
// in the following n*r lines the evolution function is described in
the following way:
- on the first n lines for c1 the evolution through
the n stages, and so on
- 0 designates an empty set.
in m lines YES or
NO, if the word in the corresponding line is or is not a word
of the built language.
a b aabaa
3 4 bbb
2 3 4 abaa
... // ni is the number of sides of the polygon
... // pi is the number of crossings corresponding to the
the file CUVINTE.TXT contains words in m lines:
In the file CUVINTE.TXT there will be words containing only the allowed characters (the ones in DICTION.TXT).