QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#708690 | #5681. Caravan Trip Plans | mgoldy925# | AC ✓ | 15ms | 10872kb | Python3 | 571b | 2024-11-04 03:33:30 | 2024-11-04 03:33:31 |
Judging History
answer
import sys
import math
input = sys.stdin.readline
ints = lambda : map(int, input().split())
intsl = lambda : list(ints())
def main():
n, m = ints()
os = intsl()
ans = []
def choose(n,k):
return int(math.factorial(n) / math.factorial(k) / math.factorial(n-k))
for _ in range(m):
dm, tm = ints()
days = tm - os[dm-1]
oases = dm + 1
ans.append(0 if days < 0 else choose(days+oases-1, days))
print("\n".join(map(str, ans)))
if __name__ == "__main__":
main()
详细
Test #1:
score: 100
Accepted
time: 15ms
memory: 10828kb
input:
5 1 2 3 5 7 11 3 7
output:
10
result:
ok single line: '10'
Test #2:
score: 0
Accepted
time: 15ms
memory: 10748kb
input:
8 3 2 3 5 7 11 13 17 19 3 7 5 15 8 24
output:
10 126 1287
result:
ok 3 lines
Test #3:
score: 0
Accepted
time: 9ms
memory: 10740kb
input:
15 5 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 7 23 10 35 4 14 5 23 15 56
output:
1716 8008 330 6188 1307504
result:
ok 5 lines
Test #4:
score: 0
Accepted
time: 10ms
memory: 10832kb
input:
20 5 3 5 8 10 13 15 18 20 23 25 28 30 33 35 38 40 43 45 48 50 5 23 7 25 13 39 16 50 20 59
output:
3003 3432 27132 5311735 10015005
result:
ok 5 lines
Test #5:
score: 0
Accepted
time: 11ms
memory: 10832kb
input:
20 5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 7 10 3 7 15 20 20 25 11 18
output:
120 35 15504 53130 31824
result:
ok 5 lines
Test #6:
score: 0
Accepted
time: 11ms
memory: 10872kb
input:
20 5 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 5 15 12 29 8 19 15 40 20 50
output:
252 6188 165 3268760 30045015
result:
ok 5 lines
Test #7:
score: 0
Accepted
time: 15ms
memory: 10832kb
input:
20 5 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 20 60 19 60 18 60 17 60 16 60
output:
137846528820 244662670200 353697121050 421171648758 416714805914
result:
ok 5 lines
Test #8:
score: 0
Accepted
time: 15ms
memory: 10708kb
input:
20 5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 40 20 60 19 60 18 60 17 60 16 60
output:
137846528820 2044802197953900 925029565741050 387221678682300 149608375854525
result:
ok 5 lines
Test #9:
score: 0
Accepted
time: 14ms
memory: 10784kb
input:
12 5 2 3 5 7 11 13 17 19 23 29 31 37 2 60 5 60 7 60 9 60 11 60
output:
1711 3162510 99884400 1101716330 2311801440
result:
ok 5 lines
Test #10:
score: 0
Accepted
time: 4ms
memory: 10836kb
input:
17 5 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 12 60 15 60 17 60 13 60 16 60
output:
834451800 37442160 18 347373600 245157
result:
ok 5 lines
Test #11:
score: 0
Accepted
time: 14ms
memory: 10740kb
input:
20 5 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 3 60 5 60 7 60 13 60 16 60
output:
17296 1370754 38320568 5414950296 4059928950
result:
ok 5 lines
Test #12:
score: 0
Accepted
time: 5ms
memory: 10784kb
input:
20 5 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 3 20 5 30 7 40 13 50 16 60
output:
56 4368 346104 37442160 4059928950
result:
ok 5 lines