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

13 行
263B

  1. import re
  2. ans1 = ans2 = 0
  3. for line in open(0).read().splitlines():
  4. a, b, c, d = map(int, re.findall(r'\d+', line))
  5. ab = set(range(a, b + 1))
  6. cd = set(range(c, d + 1))
  7. ans1 += ab <= cd or cd <= ab
  8. ans2 += any(ab & cd)
  9. print(ans1)
  10. print(ans2)