QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#380495 | #8565. Basic Blooms | ucup-team1766# | WA | 1724ms | 50104kb | Python3 | 612b | 2024-04-07 04:52:20 | 2024-04-07 04:52:22 |
Judging History
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 % 20000 == 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])
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1576ms
memory: 50104kb
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: 1724ms
memory: 50084kb
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:
88565802 385830134 579417050 155825526 245977070 451008499 477324827 870505522 289679416 181166804 841706442 442328053 557993871 362481717 289679416 501917221 236018932 119471524 650451452 823036463 747516104 715656914 832063045 557993871 794038221 363140626 494556625 715643148 811088028 823036463 2...
result:
wrong answer 1st numbers differ - expected: '957904590', found: '88565802'