QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#380547 | #8565. Basic Blooms | ucup-team1766# | WA | 1541ms | 49620kb | Python3 | 675b | 2024-04-07 05:41:30 | 2024-04-07 05:41:31 |
Judging History
answer
from heapq import *
MOD = 998244353
def sqrt(n):
return n // 10000000000000000
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 % 10000 == 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]+MOD)%MOD)
詳細信息
Test #1:
score: 100
Accepted
time: 1252ms
memory: 49600kb
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: 1541ms
memory: 49620kb
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:
628877944 820235900 601475396 932812865 26650098 667799619 402020226 483676085 587155963 204931781 940814280 662513285 734377245 230863356 587155963 564908455 470612368 207742507 839024754 726613763 894114619 959684376 48912585 734377245 136293968 882623199 19223149 561357496 932734280 726613763 453...
result:
wrong answer 1st numbers differ - expected: '957904590', found: '628877944'