結果
| 問題 |
No.762 PDCAパス
|
| コンテスト | |
| ユーザー |
Yamada
|
| 提出日時 | 2018-12-27 21:40:17 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 710 bytes |
| コンパイル時間 | 92 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 23,680 KB |
| 最終ジャッジ日時 | 2024-10-01 14:54:59 |
| 合計ジャッジ時間 | 8,680 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 WA * 2 |
ソースコード
N,M =map(int,input().split())
str =input()
pdca ={l:list() for l in ["PD","DC","CA"]}
for i in range(M):
s,t =map(int,input().split())
str2 =str[s-1]+str[t-1]
if str2 =="PD":
pdca["PD"].append([s,t])
elif str2 =="DP":
pdca["PD"].append([t,s])
elif str2 =="DC":
pdca["DC"].append([s,t])
elif str2 =="CD":
pdca["DC"].append([t,s])
elif str2 =="CA":
pdca["CA"].append([s,t])
elif str2 =="AC":
pdca["CA"].append([t,s])
sum = 0
dclist =[0]*N
calist =[0]*N
for lis in pdca["CA"]:
calist[lis[0]-1] += 1
for lis in pdca["DC"]:
dclist[lis[0]-1] += calist[lis[1]-1]
for lis in pdca["PD"]:
sum += dclist[lis[1]-1]
print(sum)
Yamada