2023-11-01 22:41:04 +01:00
|
|
|
import sys
|
|
|
|
def write_answer(answer):
|
2023-11-01 23:04:51 +01:00
|
|
|
with open(output_file, 'a') as file:
|
2023-11-01 22:41:04 +01:00
|
|
|
file.write(answer+'\n')
|
|
|
|
def find_next_position(position, character):
|
2023-11-01 23:04:51 +01:00
|
|
|
with open(used_table, 'r') as readed_used_table:
|
2023-11-01 22:41:04 +01:00
|
|
|
for row_used_table in readed_used_table:
|
|
|
|
line = row_used_table.strip().split('\t')
|
|
|
|
if position == line[0] and character == line[2]:
|
|
|
|
return True,line[1]
|
2023-11-08 18:48:12 +01:00
|
|
|
|
2023-11-08 19:00:27 +01:00
|
|
|
# used_table = 'fsa_description.arg'
|
|
|
|
# input_file = 'test1.in'
|
|
|
|
# output_file = 'test1.out'
|
|
|
|
used_table = sys.argv[1]
|
|
|
|
input_file = sys.argv[2]
|
|
|
|
output_file = sys.argv[3]
|
2023-11-01 23:04:51 +01:00
|
|
|
with open(output_file, 'w') as readed_output_file:
|
|
|
|
with open(input_file, 'r') as readed_input_file:
|
2023-11-01 22:41:04 +01:00
|
|
|
for row_input_file in readed_input_file:
|
|
|
|
result = False
|
|
|
|
next_position = None
|
|
|
|
position = '0'
|
|
|
|
for character in row_input_file:
|
|
|
|
if character =='\n':
|
|
|
|
if position=='3':
|
|
|
|
write_answer('YES')
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
write_answer('NO')
|
|
|
|
break
|
|
|
|
result, next_position = find_next_position(position,character)
|
|
|
|
if result == True:
|
|
|
|
position = next_position
|