結果
問題 |
No.3040 Aoiスコア
|
ユーザー |
![]() |
提出日時 | 2025-03-01 02:19:51 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 597 ms / 1,000 ms |
コード長 | 989 bytes |
コンパイル時間 | 215 ms |
コンパイル使用メモリ | 82,716 KB |
実行使用メモリ | 77,408 KB |
最終ジャッジ日時 | 2025-06-20 21:02:08 |
合計ジャッジ時間 | 4,233 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
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("?") ANS=0 POW26=[1] for i in range(10000): POW26.append(POW26[-1]*26%mod) for i in range(N): for to in E[i]: for toto in E[to]: if i==toto: continue x,y,z=i,to,toto 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)