fdgg
This commit is contained in:
parent
f7b1146823
commit
827ba1c20e
0
TaskE00/Makefile
Normal file
0
TaskE00/Makefile
Normal file
27
TaskE00/run
Executable file
27
TaskE00/run
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
|
sciezki = {};
|
||||||
|
stanyakceptujace = [];
|
||||||
|
f = open(sys.argv[1], "r");
|
||||||
|
lines = f.readlines();
|
||||||
|
for line in lines:
|
||||||
|
answer = re.match('^([0-9]+) ([0-9]+) ([a-z]*)$', line);
|
||||||
|
if answer:
|
||||||
|
try:
|
||||||
|
sciezki[answer.group(1)][answer.group(3)] = answer.group(2);
|
||||||
|
except KeyError:
|
||||||
|
sciezki.update({answer.group(1):{}})
|
||||||
|
sciezki[answer.group(1)][answer.group(3)] = answer.group(2);
|
||||||
|
else:
|
||||||
|
stanyakceptujace.append(int(line[:-1]));
|
||||||
|
for input in sys.stdin.readlines():
|
||||||
|
act = 0;
|
||||||
|
for char in input[:-1]:
|
||||||
|
act = int(sciezki[str(act)][char])
|
||||||
|
if act in stanyakceptujace:
|
||||||
|
print("YES")
|
||||||
|
else:
|
||||||
|
print("NO")
|
Loading…
Reference in New Issue
Block a user