summaryrefslogtreecommitdiff
path: root/python/bicicletta.py
blob: d3c181a0ce07a34c03ed4219c46b30c005c8d3d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
posBici = []
m = [0, 0]

with open('input.txt', 'r') as fin:
    info = fin.readline().split(' ')

    for i in range(int(info[0])):
        posBici.append(int(fin.readline()))

    for i in range(int(info[1])):
        passo = fin.readline().split(' ')

        for j in range(int(info[0])):
            if posBici[j] == passo[0]:
                m[0] = j

            if posBici[j] == passo[1]:
                m[1] = j


        posBici[m[0]] = passo[1]
        posBici[m[1]] = passo[0]


with open('output.txt', 'w') as fout:
    fout.write(str(posBici[0]))