QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#373413#5547. Short FunctionohwphilTL 10ms9644kbPython3375b2024-04-01 16:30:432024-04-01 16:30:45

Judging History

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

  • [2024-04-01 16:30:45]
  • 评测
  • 测评结果:TL
  • 用时:10ms
  • 内存:9644kb
  • [2024-04-01 16:30:43]
  • 提交

answer

import sys
MOD=119<<23|1
input=sys.stdin.readline
n,k=map(int,input().split())
*nums,=map(int,input().split())
cum_prod=[1]*(2*n+1)
for i in range(2*n):
    cum_prod[i+1]=(cum_prod[i]*nums[i%n])%MOD
cycle=(1<<k)//n
out=(1<<k)%n
ans=[pow(cum_prod[n],cycle,MOD)]*n
for i in range(n):
    ans[i]*=cum_prod[i+out]*pow(cum_prod[i],-1,MOD)
    ans[i]%=MOD
print(*ans)

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 10ms
memory: 9488kb

input:

5 2
1 2 3 4 5

output:

24 120 60 40 30

result:

ok 5 number(s): "24 120 60 40 30"

Test #2:

score: 0
Accepted
time: 9ms
memory: 9472kb

input:

8 3
12 5 16 14 10 6 9 2

output:

14515200 14515200 14515200 14515200 14515200 14515200 14515200 14515200

result:

ok 8 numbers

Test #3:

score: 0
Accepted
time: 7ms
memory: 9644kb

input:

6 10
3 7 8 2 9 5

output:

56347321 169041963 833775940 811788154 844769833 639990479

result:

ok 6 numbers

Test #4:

score: 0
Accepted
time: 8ms
memory: 9588kb

input:

2 100
1 2

output:

917380677 917380677

result:

ok 2 number(s): "917380677 917380677"

Test #5:

score: 0
Accepted
time: 5ms
memory: 9568kb

input:

1 1
1

output:

1

result:

ok 1 number(s): "1"

Test #6:

score: -100
Time Limit Exceeded

input:

119 1000000000
179906895 883175111 831258723 617910763 41850684 952649819 667608052 992898634 871657688 261948841 858714230 452797779 698675390 39373823 268148685 762575950 789163136 676908074 134428624 583625412 549545785 415007638 564283552 596519552 575204092 884934270 632550339 21505752 66058955...

output:


result: