結果
| 問題 | No.3114 0→1 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-19 11:22:17 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 354 bytes |
| 記録 | |
| コンパイル時間 | 1,094 ms |
| コンパイル使用メモリ | 21,288 KB |
| 実行使用メモリ | 15,868 KB |
| 最終ジャッジ日時 | 2026-07-09 22:31:57 |
| 合計ジャッジ時間 | 6,087 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 30 |
ソースコード
def min_operations_to_good_string(s: str) -> int:
cnt = 0
stack = []
for c in s:
if c == '1':
stack.append(1)
else: # c == '0'
if stack and stack[-1] == 1:
stack.pop() # pair with previous 1
else:
cnt += 1 # need to change this 0 to 1
return cnt