結果
| 問題 |
No.2219 Re:010
|
| コンテスト | |
| ユーザー |
mkawa2
|
| 提出日時 | 2023-02-17 22:59:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 62 ms / 2,000 ms |
| コード長 | 993 bytes |
| コンパイル時間 | 168 ms |
| コンパイル使用メモリ | 82,556 KB |
| 実行使用メモリ | 76,032 KB |
| 最終ジャッジ日時 | 2024-07-19 14:12:19 |
| 合計ジャッジ時間 | 2,231 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
import sys
# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# inf = (1 << 31)-1
# md = 10**9+7
md = 998244353
s = SI()
c0 = c01 = ans = 0
a = 1
for c in s:
if c == "0":
c0 += a
ans += c01
elif c == "1":
c01 += c0
else:
c0, c01, ans = c0*2+a, c01*2+c0, ans*2+c01
a = a*2%md
c0 %= md
c01 %= md
ans %= md
print(ans)
mkawa2