結果

問題 No.190 Dry Wet Moist
ユーザー roarisroaris
提出日時 2019-11-03 13:27:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 279 ms / 2,000 ms
コード長 667 bytes
コンパイル時間 1,337 ms
コンパイル使用メモリ 87,300 KB
実行使用メモリ 109,760 KB
最終ジャッジ日時 2023-10-13 01:47:09
合計ジャッジ時間 6,384 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,540 KB
testcase_01 AC 98 ms
71,552 KB
testcase_02 AC 97 ms
71,540 KB
testcase_03 AC 96 ms
71,628 KB
testcase_04 AC 97 ms
71,432 KB
testcase_05 AC 97 ms
71,776 KB
testcase_06 AC 96 ms
71,528 KB
testcase_07 AC 116 ms
77,724 KB
testcase_08 AC 112 ms
76,460 KB
testcase_09 AC 109 ms
76,600 KB
testcase_10 AC 107 ms
76,436 KB
testcase_11 AC 108 ms
76,480 KB
testcase_12 AC 195 ms
93,304 KB
testcase_13 AC 215 ms
98,652 KB
testcase_14 AC 191 ms
93,576 KB
testcase_15 AC 217 ms
101,916 KB
testcase_16 AC 246 ms
108,640 KB
testcase_17 AC 134 ms
79,400 KB
testcase_18 AC 178 ms
89,616 KB
testcase_19 AC 247 ms
108,568 KB
testcase_20 AC 204 ms
95,984 KB
testcase_21 AC 136 ms
79,412 KB
testcase_22 AC 214 ms
109,760 KB
testcase_23 AC 279 ms
109,260 KB
testcase_24 AC 217 ms
109,256 KB
testcase_25 AC 98 ms
71,788 KB
testcase_26 AC 97 ms
71,408 KB
testcase_27 AC 228 ms
96,588 KB
testcase_28 AC 172 ms
87,092 KB
testcase_29 AC 184 ms
88,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import *
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
A.sort()
wet = 0
prev_idx = 2*N

for i in range(2*N):
    idx = bisect_left(A, -A[i])-1
    idx = min(idx, prev_idx-1)
    
    if i < idx:
        wet += 1
        prev_idx = idx
    else:
        break

dry = 0
prev_idx = -1

for i in range(2*N-1, -1, -1):
    idx = bisect_right(A, -A[i])
    idx = max(idx, prev_idx+1)
    
    if idx < i:
        dry += 1
        prev_idx = idx
    else:
        break

moist = 0
d = Counter(A)

for k, v in d.items():
    if k != 0:
        moist += min(d[k], d[-k])

moist //= 2
moist += d[0]//2

print(wet, dry, moist)
0