結果
| 問題 | No.3500 01 String |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-30 15:56:50 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 73 ms / 2,000 ms |
| + 166µs | |
| コード長 | 406 bytes |
| 記録 | |
| コンパイル時間 | 216 ms |
| コンパイル使用メモリ | 15,104 KB |
| 実行使用メモリ | 30,376 KB |
| 最終ジャッジ日時 | 2026-09-30 15:58:20 |
| 合計ジャッジ時間 | 3,034 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
MOD = 998244353
import collections
def solve(S: str) -> None:
s = collections.deque(S)
while s and s[0] == "1":
s.popleft()
while s and s[-1] == "0":
s.pop()
s = "".join(s).replace("10", "1 0").split()
result = 1
for substring in s:
result = result * (len(substring) + 1) % MOD
print(result)
if __name__ == "__main__":
input()
solve(input())