結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
70,980 KB
testcase_01 AC 70 ms
71,128 KB
testcase_02 AC 77 ms
71,328 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 73 ms
71,272 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 136 ms
98,024 KB
testcase_13 AC 153 ms
103,856 KB
testcase_14 AC 148 ms
98,176 KB
testcase_15 AC 150 ms
103,140 KB
testcase_16 AC 172 ms
110,592 KB
testcase_17 AC 105 ms
78,016 KB
testcase_18 AC 127 ms
92,716 KB
testcase_19 AC 169 ms
110,284 KB
testcase_20 AC 145 ms
101,884 KB
testcase_21 AC 88 ms
76,188 KB
testcase_22 AC 166 ms
111,716 KB
testcase_23 AC 173 ms
109,948 KB
testcase_24 AC 179 ms
108,592 KB
testcase_25 AC 72 ms
71,268 KB
testcase_26 AC 71 ms
70,988 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
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