結果
問題 |
No.2926 Botaoshi
|
ユーザー |
![]() |
提出日時 | 2024-10-12 15:32:21 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 153 ms / 2,000 ms |
コード長 | 363 bytes |
コンパイル時間 | 181 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 87,168 KB |
最終ジャッジ日時 | 2024-10-12 15:32:59 |
合計ジャッジ時間 | 5,551 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 42 |
ソースコード
N = int(input()) S = list(input()) DP = [0]*3 mod = 998244353 v = list('LRU.').index(S[0]) if v==3: DP=[1]*3 else: DP[v]=1 for s in S[1:]: NDP = [0]*3 if s=='L' or s=='.': NDP[0]=(DP[0]+DP[2])%mod if s=='R' or s=='.': NDP[1]=sum(DP)%mod if s=='U' or s=='.': NDP[2]=sum(DP)%mod DP = NDP print(sum(DP)%mod)