結果
問題 | No.389 ロジックパズルの組み合わせ |
ユーザー | vwxyz |
提出日時 | 2021-07-31 10:39:59 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,183 bytes |
コンパイル時間 | 341 ms |
コンパイル使用メモリ | 82,452 KB |
実行使用メモリ | 258,776 KB |
最終ジャッジ日時 | 2024-09-16 09:11:29 |
合計ジャッジ時間 | 37,859 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 135 ms
89,424 KB |
testcase_02 | WA | - |
testcase_03 | AC | 134 ms
89,472 KB |
testcase_04 | WA | - |
testcase_05 | AC | 143 ms
89,344 KB |
testcase_06 | AC | 134 ms
89,600 KB |
testcase_07 | AC | 134 ms
89,344 KB |
testcase_08 | AC | 135 ms
89,472 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | AC | 197 ms
144,128 KB |
testcase_50 | AC | 144 ms
89,728 KB |
testcase_51 | AC | 147 ms
89,728 KB |
testcase_52 | AC | 155 ms
96,612 KB |
testcase_53 | AC | 143 ms
91,008 KB |
testcase_54 | AC | 153 ms
97,792 KB |
testcase_55 | AC | 141 ms
89,856 KB |
testcase_56 | AC | 150 ms
90,496 KB |
testcase_57 | AC | 170 ms
111,616 KB |
testcase_58 | AC | 200 ms
136,832 KB |
testcase_59 | AC | 184 ms
122,496 KB |
testcase_60 | AC | 157 ms
102,272 KB |
testcase_61 | AC | 261 ms
154,368 KB |
testcase_62 | AC | 171 ms
104,320 KB |
testcase_63 | AC | 199 ms
137,088 KB |
testcase_64 | AC | 159 ms
98,048 KB |
testcase_65 | AC | 153 ms
93,952 KB |
testcase_66 | AC | 158 ms
102,016 KB |
testcase_67 | AC | 158 ms
100,480 KB |
testcase_68 | AC | 164 ms
99,200 KB |
testcase_69 | WA | - |
testcase_70 | WA | - |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | WA | - |
testcase_74 | WA | - |
testcase_75 | WA | - |
testcase_76 | WA | - |
testcase_77 | WA | - |
testcase_78 | WA | - |
testcase_79 | WA | - |
testcase_80 | WA | - |
testcase_81 | WA | - |
testcase_82 | WA | - |
testcase_83 | WA | - |
testcase_84 | WA | - |
testcase_85 | WA | - |
testcase_86 | WA | - |
testcase_87 | WA | - |
testcase_88 | WA | - |
testcase_89 | WA | - |
testcase_90 | WA | - |
testcase_91 | WA | - |
testcase_92 | WA | - |
testcase_93 | WA | - |
testcase_94 | WA | - |
testcase_95 | WA | - |
testcase_96 | WA | - |
testcase_97 | WA | - |
testcase_98 | WA | - |
ソースコード
import bisect import copy import decimal import fractions import heapq import itertools import math import random import sys from collections import Counter,deque,defaultdict from functools import lru_cache,reduce from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max def _heappush_max(heap,item): heap.append(item) heapq._siftdown_max(heap, 0, len(heap)-1) def _heappushpop_max(heap, item): if heap and item < heap[0]: item, heap[0] = heap[0], item heapq._siftup_max(heap, 0) return item from math import gcd as GCD, modf read=sys.stdin.read readline=sys.stdin.readline readlines=sys.stdin.readlines def Extended_Euclid(n,m): stack=[] while m: stack.append((n,m)) n,m=m,n%m if n>=0: x,y=1,0 else: x,y=-1,0 for i in range(len(stack)-1,-1,-1): n,m=stack[i] x,y=y,x-(n//m)*y return x,y class MOD: def __init__(self,mod): self.mod=mod def Pow(self,a,n): a%=self.mod if n>=0: return pow(a,n,self.mod) else: assert math.gcd(a,self.mod)==1 x=Extended_Euclid(a,self.mod)[0] return pow(x,-n,self.mod) def Build_Fact(self,N): assert N>=0 self.factorial=[1] for i in range(1,N+1): self.factorial.append((self.factorial[-1]*i)%self.mod) self.factorial_inv=[None]*(N+1) self.factorial_inv[-1]=self.Pow(self.factorial[-1],-1) for i in range(N-1,-1,-1): self.factorial_inv[i]=(self.factorial_inv[i+1]*(i+1))%self.mod return self.factorial_inv def Fact(self,N): return self.factorial[N] def Fact_Inv(self,N): return self.factorial_inv[N] def Comb(self,N,K): if K<0 or K>N: return 0 s=self.factorial[N] s=(s*self.factorial_inv[K])%self.mod s=(s*self.factorial_inv[N-K])%self.mod return s M,*H=map(int,read().split()) S=sum(H)+len(H)-1 if H==[0]: ans=1 elif S>M: ans='NA' else: mod=10**9+7 MD=MOD(mod) MD.Build_Fact(2*10**6) ans=MD.Comb(M-S+len(H),len(H)) print(M,S) print(ans)