QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#380488#8565. Basic Bloomsucup-team1766#WA 760ms49088kbPython3606b2024-04-07 04:47:002024-04-07 04:47:00

Judging History

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

  • [2024-04-07 04:47:00]
  • 评测
  • 测评结果:WA
  • 用时:760ms
  • 内存:49088kb
  • [2024-04-07 04:47:00]
  • 提交

answer

from heapq import *
MOD = 998244353

flowers = [0] * 1000001

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

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

t = int(input())

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 760ms
memory: 49088kb

input:

3
1 2
1 10
15 2000

output:

1
5
735036421

result:

wrong answer 1st numbers differ - expected: '3', found: '1'