結果
問題 |
No.3114 0→1
|
ユーザー |
|
提出日時 | 2025-04-20 01:05:48 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 565 bytes |
コンパイル時間 | 442 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2025-04-20 01:05:52 |
合計ジャッジ時間 | 3,637 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 30 |
ソースコード
def min_operations_to_good_string(n, s): operations = 0 i = 0 while i < n - 1: if s[i] == '0' and s[i + 1] == '0': # Start of a block of violating 0s start = i while i + 1 < n and s[i + 1] == '0': i += 1 length = i - start + 1 operations += (length + 1) // 2 # ceil(length / 2) i += 1 else: i += 1 return operations if __name__ == "__main__": n = int(input()) s = input().strip() min_operations_to_good_string(n, s)