Миронов Денис, 519/2 группа PackedQueue 2153 | Назаров Дмитрий 519/2 PackedQueue 2968 | ||||
---|---|---|---|---|---|
f | 1 | from collections import deque | f | 1 | from collections import deque |
n | 2 | conv = deque() | n | 2 | deq = deque() |
3 | for obj in eval(input()): | 3 | for o in eval(input()): | ||
4 | if isinstance(obj, tuple): | 4 | if isinstance(o, tuple): | ||
5 | conv.extend(obj) | 5 | deq.extend(o) | ||
6 | elif isinstance(obj, int): | 6 | elif isinstance(o, int): | ||
7 | tmp = deque() | 7 | deq2 = deque() | ||
8 | try: | 8 | try: | ||
n | 9 | for _ in range(obj): | n | 9 | for _ in range(o): |
10 | tmp.append(conv.popleft()) | 10 | deq2.append(deq.popleft()) | ||
11 | except IndexError: | 11 | except IndexError: | ||
12 | break | 12 | break | ||
t | 13 | print(tuple(tmp)) | t | 13 | print(tuple(deq2)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|