QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#380540#8565. Basic Bloomsucup-team1766#WA 1852ms49768kbPython3659b2024-04-07 05:38:572024-04-07 05:38:58

Judging History

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

  • [2024-04-07 05:38:58]
  • 评测
  • 测评结果:WA
  • 用时:1852ms
  • 内存:49768kb
  • [2024-04-07 05:38:57]
  • 提交

answer

from heapq import *
MOD = 998244353
def sqrt(n):
    return n // 10000000000

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 % 50000 == 0:
        for j in range(len(heap)):
            heap[j][0] //= sqrt(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: 100
Accepted
time: 1673ms
memory: 49764kb

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: 1852ms
memory: 49768kb

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:

972952051
50628853
821944000
764547921
503198582
767843461
800426196
119881073
670685264
474556310
972279594
226450799
127050144
417977111
670685264
101898975
334373373
652521481
577923124
350452212
424365223
947921426
723246341
127050144
735691050
546791527
565467206
536400521
205033125
350452212
2...

result:

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