結果

問題 No.190 Dry Wet Moist
ユーザー roarisroaris
提出日時 2019-11-03 13:18:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 622 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 110,348 KB
最終ジャッジ日時 2023-10-13 01:46:24
合計ジャッジ時間 6,839 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,552 KB
testcase_01 AC 91 ms
71,696 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 206 ms
109,964 KB
testcase_23 AC 267 ms
110,348 KB
testcase_24 AC 206 ms
109,324 KB
testcase_25 WA -
testcase_26 AC 92 ms
71,780 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

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

d = Counter(A)
moist = 0

for k, v in d.items():
    moist += v*d[-k]

moist //= 2

print(wet, dry, moist)
0