結果

問題 No.329 全射
ユーザー TawaraTawara
提出日時 2015-12-26 04:50:45
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 247 ms / 2,000 ms
コード長 590 bytes
コンパイル時間 509 ms
コンパイル使用メモリ 77,500 KB
実行使用メモリ 88,108 KB
最終ジャッジ日時 2023-10-19 03:58:27
合計ジャッジ時間 7,706 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
76,324 KB
testcase_01 AC 75 ms
76,324 KB
testcase_02 AC 77 ms
76,324 KB
testcase_03 AC 76 ms
76,324 KB
testcase_04 AC 76 ms
76,324 KB
testcase_05 AC 75 ms
76,324 KB
testcase_06 AC 74 ms
76,324 KB
testcase_07 AC 73 ms
76,324 KB
testcase_08 AC 74 ms
76,324 KB
testcase_09 AC 75 ms
76,324 KB
testcase_10 AC 77 ms
76,324 KB
testcase_11 AC 75 ms
76,324 KB
testcase_12 AC 74 ms
76,324 KB
testcase_13 AC 232 ms
88,108 KB
testcase_14 AC 188 ms
88,104 KB
testcase_15 AC 195 ms
87,912 KB
testcase_16 AC 194 ms
87,940 KB
testcase_17 AC 226 ms
87,984 KB
testcase_18 AC 243 ms
87,996 KB
testcase_19 AC 247 ms
88,084 KB
testcase_20 AC 226 ms
88,008 KB
testcase_21 AC 208 ms
87,972 KB
testcase_22 AC 243 ms
88,068 KB
testcase_23 AC 142 ms
87,164 KB
testcase_24 AC 150 ms
87,216 KB
testcase_25 AC 176 ms
87,296 KB
testcase_26 AC 158 ms
87,240 KB
testcase_27 AC 133 ms
87,408 KB
testcase_28 AC 91 ms
81,008 KB
testcase_29 AC 114 ms
81,432 KB
testcase_30 AC 104 ms
81,344 KB
testcase_31 AC 84 ms
80,436 KB
testcase_32 AC 131 ms
86,352 KB
testcase_33 AC 145 ms
81,032 KB
testcase_34 AC 136 ms
81,032 KB
testcase_35 AC 156 ms
81,024 KB
testcase_36 AC 149 ms
81,032 KB
testcase_37 AC 136 ms
81,036 KB
testcase_38 AC 144 ms
81,036 KB
testcase_39 AC 145 ms
81,036 KB
testcase_40 AC 160 ms
81,036 KB
testcase_41 AC 139 ms
81,032 KB
testcase_42 AC 159 ms
81,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

I = lambda:map(int,raw_input().split()) 
p = 10**9+7
N,M = I();w = I();Mw = max(w)
E = [[0]*N for i in xrange(N)]
dp = [[0]*(Mw+1) for i in xrange(Mw+1)]
dp[0][0]=1
for i in xrange(Mw):
	for j in xrange(i+1):
		dp[i+1][j+1] = (j+1)*(dp[i][j+1]+dp[i][j]) % p
for i in xrange(N): E[i][i] = w[i]
for t in xrange(M): i,j = I();E[i-1][j-1] = w[i-1]
for k in xrange(N):
	for i in xrange(N):
		for j in xrange(N):
			t = E[k][j]
			if E[i][k] < t: t = E[i][k]
			if E[i][j] < t: E[i][j] = t
A = 0
for i in xrange(N):
	for j in xrange(N):
		if w[j] <= E[i][j]:
			A = (A+dp[w[i]][w[j]]) % p
print A
0