summaryrefslogtreecommitdiffstats
path: root/Main/Python/2015/S3.py
blob: 3fee27f2dad385f2b7ba7aeab644668df8035f4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
G = int(input())
P = int(input())

closed = False
count= 0
docks = set()
for i in range(P):
    g = int(input())
    if not closed:
        can_land = False
        for d in range(g,0,-1):
            if d not in docks:
                docks.add(d)
                can_land = True
                break
        if not can_land:
            closed = True
        else:
            count += 1
print(count)