QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#380496#8565. Basic Bloomsucup-team1766#WA 1851ms50012kbPython3612b2024-04-07 04:53:092024-04-07 04:53:10

Judging History

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

  • [2024-04-07 04:53:10]
  • 评测
  • 测评结果:WA
  • 用时:1851ms
  • 内存:50012kb
  • [2024-04-07 04:53:09]
  • 提交

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])
i = 1
while i < len(flowers):
    v,b,d,m = heappop(heap)
    if m != flowers[i-1]:
        flowers[i] = m
        i+=1
    heappush(heap, [v*b+d, b, d, (m*b+d)%MOD])
    if i % 40000 == 0:
        for j in range(len(heap)):
            heap[j][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])

详细

Test #1:

score: 100
Accepted
time: 1639ms
memory: 49964kb

input:

3
1 2
1 10
15 2000

output:

3
55
736374621

result:

ok 3 number(s): "3 55 736374621"

Test #2:

score: -100
Wrong Answer
time: 1851ms
memory: 50012kb

input:

100000
26 99975
57 99944
28 99973
62 99939
71 99930
25 99976
53 99948
60 99941
73 99928
72 99929
30 99971
7 99994
3 99998
35 99966
73 99928
68 99933
83 99918
37 99964
63 99938
17 99984
34 99967
74 99927
6 99995
3 99998
23 99978
91 99910
39 99962
85 99916
82 99919
17 99984
61 99940
31 99970
44 99957
...

output:

270005799
389931785
828295200
837911390
138592281
413266656
638714567
950844479
216407589
727518566
947903460
95029872
700023373
642163839
216407589
761284572
462390723
971886542
180768754
457539898
479746203
855237010
462760374
700023373
338899890
764570922
981616870
58523423
269928966
457539898
28...

result:

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