結果

問題 No.329 全射
ユーザー TawaraTawara
提出日時 2015-12-26 04:52:52
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 590 bytes
コンパイル時間 48 ms
コンパイル使用メモリ 7,148 KB
実行使用メモリ 11,364 KB
最終ジャッジ日時 2023-10-19 03:58:49
合計ジャッジ時間 3,913 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,464 KB
testcase_01 AC 11 ms
6,464 KB
testcase_02 AC 11 ms
6,464 KB
testcase_03 AC 11 ms
6,464 KB
testcase_04 AC 11 ms
6,464 KB
testcase_05 AC 11 ms
6,464 KB
testcase_06 AC 11 ms
6,464 KB
testcase_07 AC 12 ms
6,464 KB
testcase_08 AC 11 ms
6,464 KB
testcase_09 AC 12 ms
6,464 KB
testcase_10 AC 11 ms
6,464 KB
testcase_11 AC 11 ms
6,464 KB
testcase_12 AC 11 ms
6,464 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
権限があれば一括ダウンロードができます

ソースコード

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