結果
問題 |
No.3114 0→1
|
ユーザー |
|
提出日時 | 2025-04-19 11:22:17 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 354 bytes |
コンパイル時間 | 167 ms |
コンパイル使用メモリ | 11,904 KB |
実行使用メモリ | 10,112 KB |
最終ジャッジ日時 | 2025-04-19 11:22:20 |
合計ジャッジ時間 | 2,649 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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