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