您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

17 行
468B

  1. import collections
  2. import itertools
  3. reindeers = [
  4. itertools.accumulate(itertools.cycle([speed] * act + [0] * rest))
  5. for line in df.read_text().splitlines()
  6. for speed, act, rest in [map(int, re.findall(r'\d+', line))]
  7. ]
  8. traveled = [[next(rr) for _ in range(2503)] for rr in reindeers]
  9. transpose = list(zip(*traveled))
  10. ans1 = max(transpose[-1])
  11. points = [[d == max(dsts) for d in dsts] for dsts in transpose]
  12. ans2 = max(sum(pts) for pts in zip(*points))