結果

問題 No.762 PDCAパス
ユーザー convexineqconvexineq
提出日時 2021-03-31 02:14:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 415 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 91,216 KB
最終ジャッジ日時 2023-08-20 21:57:12
合計ジャッジ時間 8,701 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
71,220 KB
testcase_01 AC 75 ms
71,388 KB
testcase_02 AC 77 ms
71,212 KB
testcase_03 AC 76 ms
71,188 KB
testcase_04 AC 78 ms
71,404 KB
testcase_05 AC 76 ms
71,016 KB
testcase_06 AC 80 ms
71,216 KB
testcase_07 AC 82 ms
71,232 KB
testcase_08 AC 81 ms
71,496 KB
testcase_09 AC 78 ms
71,316 KB
testcase_10 AC 78 ms
71,216 KB
testcase_11 AC 78 ms
71,220 KB
testcase_12 AC 77 ms
71,280 KB
testcase_13 AC 78 ms
71,228 KB
testcase_14 AC 81 ms
71,416 KB
testcase_15 AC 78 ms
71,180 KB
testcase_16 AC 78 ms
71,188 KB
testcase_17 AC 77 ms
71,220 KB
testcase_18 AC 76 ms
71,220 KB
testcase_19 AC 76 ms
71,416 KB
testcase_20 AC 77 ms
71,184 KB
testcase_21 AC 76 ms
71,180 KB
testcase_22 AC 222 ms
79,832 KB
testcase_23 AC 161 ms
79,788 KB
testcase_24 AC 234 ms
90,748 KB
testcase_25 AC 230 ms
90,588 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 265 ms
91,208 KB
testcase_29 AC 265 ms
91,216 KB
testcase_30 AC 258 ms
88,740 KB
testcase_31 AC 258 ms
88,636 KB
testcase_32 AC 267 ms
88,508 KB
testcase_33 AC 239 ms
86,488 KB
testcase_34 AC 249 ms
86,536 KB
testcase_35 AC 244 ms
86,264 KB
testcase_36 AC 215 ms
82,756 KB
testcase_37 AC 218 ms
82,728 KB
testcase_38 AC 217 ms
82,964 KB
testcase_39 AC 228 ms
82,900 KB
testcase_40 AC 219 ms
82,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
s = input()
g = [[] for _ in range(n)]
for _ in range(m):
    a,b = map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)

r = [int(si=="P") for si in s]
for A,B in ["PD","DC","CA"]:
    nr = [0]*n
    for i in range(n):
        if r[i] and s[i] == A:
            for c in g[i]:
                if s[c] == B:
                    nr[c] += r[i]
    r = nr
print(sum(r))
0