結果
問題 |
No.3015 右に寄せろ!
|
ユーザー |
|
提出日時 | 2025-01-25 14:02:45 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 379 bytes |
コンパイル時間 | 156 ms |
コンパイル使用メモリ | 82,292 KB |
実行使用メモリ | 276,624 KB |
最終ジャッジ日時 | 2025-01-25 23:05:37 |
合計ジャッジ時間 | 6,869 ms |
ジャッジサーバーID (参考情報) |
judge9 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 26 |
ソースコード
from collections import deque q=list(str(input())) q=deque(list(map(int,q))) ans=0 s=deque() while q: x=q.popleft() s.append(x) if 3<=len(s): if s[-3]==1 and s[-2]==1 and s[-1]==0: s[-3]=0 s[-1]=1 ans+=1 while s: x=s.pop() q.appendleft(x) if 3<=len(q): if q[0]==1 and q[1]==1 and q[2]==0: q[0]=0 q[2]=1 ans+=1 print(ans)