結果

問題 No.762 PDCAパス
ユーザー cielciel
提出日時 2018-12-11 00:49:41
言語 Crystal
(1.11.2)
結果
WA  
実行時間 -
コード長 403 bytes
コンパイル時間 19,763 ms
コンパイル使用メモリ 256,324 KB
実行使用メモリ 9,528 KB
最終ジャッジ日時 2023-09-13 09:54:11
合計ジャッジ時間 19,243 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,376 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 2 ms
4,436 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,392 KB
testcase_06 AC 2 ms
4,444 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 2 ms
4,460 KB
testcase_10 AC 2 ms
4,464 KB
testcase_11 AC 3 ms
4,380 KB
testcase_12 AC 3 ms
4,484 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 3 ms
4,416 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 3 ms
4,376 KB
testcase_20 AC 3 ms
4,508 KB
testcase_21 AC 2 ms
4,444 KB
testcase_22 AC 29 ms
7,984 KB
testcase_23 AC 30 ms
7,988 KB
testcase_24 AC 26 ms
7,452 KB
testcase_25 AC 26 ms
7,448 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 35 ms
9,520 KB
testcase_29 AC 35 ms
8,520 KB
testcase_30 AC 35 ms
9,432 KB
testcase_31 AC 34 ms
9,448 KB
testcase_32 AC 36 ms
9,528 KB
testcase_33 AC 35 ms
7,688 KB
testcase_34 AC 35 ms
7,764 KB
testcase_35 AC 35 ms
7,736 KB
testcase_36 AC 34 ms
7,988 KB
testcase_37 AC 35 ms
8,544 KB
testcase_38 AC 34 ms
8,636 KB
testcase_39 AC 34 ms
7,992 KB
testcase_40 AC 34 ms
7,736 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
0