难度指数:⭐⭐⭐⭐⭐
知识点: 递归
Mine:
代码实现
from collections import defaultdict
from time import time
def solve():
return 0
def solve0():
def resort(i, l):
dic[str(l)].append(c[i])
i += 1
if f[i - 1] != 0:
l += 1
for j in range(f[i - 1]):
i, _ = resort(i, l)
return i, l
dic = defaultdict(lambda: [])
i = 0
while i < len(f):
i, _ = resort(i, 0)
hl = len(dic)
print(hl)
for i in range(hl):
print(' '.join(dic[str(i)]))
return 0
T = 1
while T:
nums = input().split(',')
c , f = [], []
for i in range(len(nums) // 2):
c.append(nums[2 * i])
f.append(int(nums[2 * i + 1]))
t1 = time()
res = solve()
t2 = time()
res0 = 0
solve0()
t3 = time()
print(res, res0)
print(t3 - t2, t2 - t1)
T -= 1