結果
問題 |
No.3040 Aoiスコア
|
ユーザー |
![]() |
提出日時 | 2025-03-01 02:17:30 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 865 bytes |
コンパイル時間 | 349 ms |
コンパイル使用メモリ | 82,168 KB |
実行使用メモリ | 743,064 KB |
最終ジャッジ日時 | 2025-06-20 21:02:09 |
合計ジャッジ時間 | 5,243 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 MLE * 1 -- * 2 |
ソースコード
import sys input = sys.stdin.readline mod=998244353 N,M=map(int,input().split()) S=input().strip() E=[[] for i in range(N)] for i in range(M): x,y=map(int,input().split()) x-=1 y-=1 E[x].append(y) E[y].append(x) ko=S.count("?") LIST=[] for i in range(N): for to in E[i]: for toto in E[to]: if i==toto: continue LIST.append((i,to,toto)) POW26=[1] for i in range(10000): POW26.append(POW26[-1]*26%mod) ANS=0 for x,y,z in LIST: count=0 if S[x]=="a": pass elif S[x]=="?": count+=1 else: continue if S[y]=="o": pass elif S[y]=="?": count+=1 else: continue if S[z]=="i": pass elif S[z]=="?": count+=1 else: continue ANS=(ANS+POW26[ko-count])%mod print(ANS)