結果

問題 No.762 PDCAパス
ユーザー cielciel
提出日時 2018-12-11 00:50:59
言語 Crystal
(1.10.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 19,841 ms
コンパイル使用メモリ 256,340 KB
実行使用メモリ 9,456 KB
最終ジャッジ日時 2023-09-13 09:56:27
合計ジャッジ時間 18,275 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,380 KB
testcase_01 AC 2 ms
4,420 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 3 ms
4,384 KB
testcase_05 AC 2 ms
4,388 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,400 KB
testcase_11 AC 2 ms
4,396 KB
testcase_12 AC 2 ms
4,424 KB
testcase_13 AC 2 ms
4,412 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 2 ms
4,448 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,412 KB
testcase_19 AC 3 ms
4,416 KB
testcase_20 AC 2 ms
4,408 KB
testcase_21 AC 3 ms
4,528 KB
testcase_22 AC 31 ms
7,996 KB
testcase_23 AC 29 ms
7,920 KB
testcase_24 AC 26 ms
7,336 KB
testcase_25 AC 26 ms
7,288 KB
testcase_26 AC 31 ms
8,284 KB
testcase_27 AC 31 ms
8,136 KB
testcase_28 AC 36 ms
8,440 KB
testcase_29 AC 36 ms
8,548 KB
testcase_30 AC 36 ms
9,436 KB
testcase_31 AC 36 ms
9,456 KB
testcase_32 AC 35 ms
9,432 KB
testcase_33 AC 34 ms
7,732 KB
testcase_34 AC 34 ms
7,688 KB
testcase_35 AC 35 ms
7,736 KB
testcase_36 AC 34 ms
8,004 KB
testcase_37 AC 34 ms
8,476 KB
testcase_38 AC 35 ms
8,676 KB
testcase_39 AC 34 ms
8,012 KB
testcase_40 AC 34 ms
7,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=gets.not_nil!.split.map &.to_i
s=gets.not_nil!.chomp
a=m.times.map{Tuple(Int32,Int32).from(gets.not_nil!.split.map{|f|f.to_i-1})}.to_a
d=[0]*n
r=0
a.each{|x,y|
	d[y]+=1 if s[x]=='P'&&s[y]=='D'
	d[x]+=1 if s[y]=='P'&&s[x]=='D'
}
a.each{|x,y|
	d[y]+=d[x] if s[x]=='D'&&s[y]=='C'
	d[x]+=d[y] if s[y]=='D'&&s[x]=='C'
}
a.each{|x,y|
	r+=d[x] if s[x]=='C'&&s[y]=='A'
	r+=d[y] if s[y]=='C'&&s[x]=='A'
}
p r % (10**9+7)
0