-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcutthesticks.py
38 lines (32 loc) · 883 Bytes
/
cutthesticks.py
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
27
28
29
30
31
32
33
34
35
36
import random,datetime,heapq
N = int(input())
#array = list(map(int,input().split()))
array = []
print (datetime.datetime.now())
for x in range(1000000):
heapq.heappush(array, random.randint(1,9))
print (datetime.datetime.now())
print (heapq.heappop(array))
print (heapq.heappop(array))
array = []
print (datetime.datetime.now())
for x in range(1000000):
array.append(random.randint(1,9))
print (datetime.datetime.now())
'''
print (datetime.datetime.now())
lens = sorted(set(array), reverse = True)
alive = len(array)
while alive != 0:
print(alive)
alive -= array.count(lens.pop())
print (datetime.datetime.now())
length = len(array)
print (datetime.datetime.now())
while length >= 1:
print (length)
min_element = min(array)
array = list(filter(lambda x: int(x-min_element) > 0, array ) )
length = len(array)
print (datetime.datetime.now())
'''