結果
| 問題 | No.762 PDCAパス |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-06 11:43:41 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 184 ms / 2,000 ms |
| コード長 | 476 bytes |
| 記録 | |
| コンパイル時間 | 200 ms |
| コンパイル使用メモリ | 77,496 KB |
| 最終ジャッジ日時 | 2025-12-04 01:57:19 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#yuki762 n,m=map(int,raw_input().split()) s=raw_input() lc=[0]*n ld=[0]*n l=[] for i in range(m): x,y=map(int,raw_input().split()) x-=1 y-=1 if s[x]=='P' and s[y]=='D': ld[y]+=1 elif s[x]=='D' and s[y]=='P': ld[x]+=1 elif s[x]=='D' and s[y]=='C': l.append([x,y]) elif s[x]=='C' and s[y]=='D': l.append([y,x]) elif s[x]=='C' and s[y]=='A': lc[x]+=1 elif s[x]=='A' and s[y]=='C': lc[y]+=1 res=0 for i in l: res+=(ld[i[0]]*lc[i[1]]) res%=10**9+7 print res