結果
問題 |
No.3114 0→1
|
ユーザー |
|
提出日時 | 2025-04-20 18:23:58 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 343 bytes |
コンパイル時間 | 288 ms |
コンパイル使用メモリ | 11,904 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2025-04-20 18:24:03 |
合計ジャッジ時間 | 4,297 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | WA * 30 |
ソースコード
N = int(input()) S = input().strip() zero = 0 one = 0 max_diff = 0 # 0の数 - 1の数 の最大値 for c in S: if c == '0': zero += 1 else: one += 1 # 現在までに 0が1より何個多いか(良い文字列違反度) diff = zero - one if diff > max_diff: max_diff = diff print(max_diff)