結果

問題 No.190 Dry Wet Moist
ユーザー 👑 rin204rin204
提出日時 2022-10-17 22:58:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 602 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 111,784 KB
最終ジャッジ日時 2023-09-10 20:54:47
合計ジャッジ時間 5,343 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,280 KB
testcase_01 AC 70 ms
71,352 KB
testcase_02 AC 71 ms
71,300 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 72 ms
71,140 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 135 ms
98,116 KB
testcase_13 AC 146 ms
103,748 KB
testcase_14 AC 133 ms
97,952 KB
testcase_15 AC 152 ms
103,156 KB
testcase_16 AC 166 ms
110,584 KB
testcase_17 AC 92 ms
77,948 KB
testcase_18 AC 122 ms
92,864 KB
testcase_19 AC 169 ms
110,324 KB
testcase_20 AC 144 ms
101,868 KB
testcase_21 AC 86 ms
76,260 KB
testcase_22 AC 162 ms
111,784 KB
testcase_23 AC 171 ms
110,184 KB
testcase_24 AC 177 ms
108,788 KB
testcase_25 AC 71 ms
71,184 KB
testcase_26 AC 70 ms
71,292 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))

def f(A):
    A.sort()
    if A[0] >= 0:
        return 0
    r = 2 * n - 1
    cnt = 0
    for l in range(n):        
        while l < r and A[l] + A[r] >= 0:
            r -= 1
        if l == r:
            break
        cnt += 1
        r -= 1
    return cnt

dry = f(A)
wet = f([-a for a in A])
cnt = {}
moi = 0
z = 0
A.sort()
for a in A:
    if a < 0:
        cnt[-a] = cnt.get(-a, 0) + 1
    elif a == 0:
        z += 1
    else:
        if cnt.get(a, 0) >= 1:
            cnt[a] -= 1
            moi += 1
moi += z // 2
print(dry, wet, moi)
0