結果
問題 |
No.3114 0→1
|
ユーザー |
![]() |
提出日時 | 2025-04-19 10:10:29 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 99 ms / 2,000 ms |
コード長 | 333 bytes |
コンパイル時間 | 675 ms |
コンパイル使用メモリ | 82,468 KB |
実行使用メモリ | 85,888 KB |
最終ジャッジ日時 | 2025-04-19 10:10:34 |
合計ジャッジ時間 | 4,568 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
from collections import deque N = int(input()) S = list(input()) cnt = 0 hoge = 3 q = deque(['1','1','1']) for c in S: #print(q,hoge) a = q.popleft() if a == '1': hoge -= 1 q.append(c) if c == '1': hoge += 1 if hoge < 2: q[2] = '1' hoge += 1 cnt += 1 print(cnt)