結果
問題 |
No.190 Dry Wet Moist
|
ユーザー |
|
提出日時 | 2015-04-22 11:10:26 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 820 bytes |
コンパイル時間 | 81 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 30,680 KB |
最終ジャッジ日時 | 2024-07-05 00:08:57 |
合計ジャッジ時間 | 3,715 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 WA * 23 |
ソースコード
def find_max_moist(Ap, Am, np, nm, n0): c = p = m = 0 while p < np and m < nm: if Ap[p] == Am[m]: c += 1 p += 1 m += 1 elif Ap[p] < Am[m]: m += 1 else: p += 1 return c + n0 // 2 def find_max_wet(Ap, Ar, np, nr): c = p = r = 0 while p < np and r < nr: if Ap[p] < Ar[r]: c += 1 p += 1 r += 1 return c + max((np - p) // 2, 0) N = int(input()) As = list(map(int, input().split())) Ap = [-a for a in As if a > 0] Am = [a for a in As if a < 0] Ap.sort() Am.sort() np = len(Ap) nm = len(Am) n0 = 2 * N - np - nm A0 = [0] * n0 dry = find_max_wet(Am, Ap+A0, nm, np + n0) wet = find_max_wet(Ap, Am+A0, np, nm + n0) moist = find_max_moist(Ap, Am, np, nm, n0) print(dry, wet, moist)