QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#380478#8565. Basic Bloomsucup-team1766#TL 0ms0kbPython3489b2024-04-07 04:36:082024-04-07 04:36:10

Judging History

你现在查看的是最新测评结果

  • [2024-04-07 04:36:10]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-04-07 04:36:08]
  • 提交

answer

from heapq import *

flowers = [0] * 1000000

heap = []
for b in range(2,17):
    for d in range(1,b):
        heappush(heap, [d, b, d])
for i in range(1,len(flowers)):
    v,b,d = heappop(heap)
    if v != flowers[i-1]:
        flowers[i] = v % 998244353
    heappush(heap, [v*b+d, b, d])

for i in range(1,len(flowers)):
    flowers[i] = (flowers[i] + flowers[i-1]) % 998244353

t = int(input())

for _ in range(t):
    a, b = map(int,input().split())
    print(flowers[b]-flowers[a-1])

详细

Test #1:

score: 0
Time Limit Exceeded

input:

3
1 2
1 10
15 2000

output:


result: