結果
問題 | No.2219 Re:010 |
ユーザー | flygon |
提出日時 | 2023-02-17 22:09:30 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 749 bytes |
コンパイル時間 | 1,776 ms |
コンパイル使用メモリ | 86,464 KB |
実行使用メモリ | 531,612 KB |
最終ジャッジ日時 | 2023-09-26 19:25:32 |
合計ジャッジ時間 | 4,456 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 74 ms
71,172 KB |
testcase_01 | AC | 74 ms
71,284 KB |
testcase_02 | AC | 75 ms
71,356 KB |
testcase_03 | MLE | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
ソースコード
s = input() mod = 998244353 ans = 0 n = len(s) pre = [] hate = [] last = 0 nowh = 0 for i in range(n): si = s[i] hate.append(last) if si == "0": last += pow(2, nowh, mod) elif si == "?": last *= 2 last += pow(2, nowh, mod) nowh += 1 pre.append(last) suf = [] hates = [] nowh = 0 last = 0 for i in range(n)[::-1]: si = s[i] hates.append(last) if si == "0": last += pow(2, nowh, mod) elif si == "?": last *= 2 last += pow(2, nowh, mod) nowh += 1 last %= mod suf.append(last) suf = suf[::-1] hates = hates[::-1] ans = 0 for i in range(1,n-1): if s[i] == "1": ans += pre[i] * suf[i] % mod ans %= mod elif s[i] == "?": ans += hate[i] * hates[i] % mod ans %= mod print(ans)