結果

問題 No.190 Dry Wet Moist
ユーザー tikitaka1201tikitaka1201
提出日時 2020-07-01 21:06:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 178 ms / 2,000 ms
コード長 643 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 86,860 KB
実行使用メモリ 114,628 KB
最終ジャッジ日時 2023-10-12 04:04:22
合計ジャッジ時間 5,833 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,476 KB
testcase_01 AC 70 ms
71,460 KB
testcase_02 AC 76 ms
71,252 KB
testcase_03 AC 73 ms
71,456 KB
testcase_04 AC 74 ms
71,248 KB
testcase_05 AC 72 ms
71,436 KB
testcase_06 AC 72 ms
71,360 KB
testcase_07 AC 81 ms
76,340 KB
testcase_08 AC 75 ms
71,308 KB
testcase_09 AC 74 ms
71,412 KB
testcase_10 AC 72 ms
71,508 KB
testcase_11 AC 73 ms
71,580 KB
testcase_12 AC 141 ms
96,688 KB
testcase_13 AC 148 ms
102,720 KB
testcase_14 AC 132 ms
95,872 KB
testcase_15 AC 148 ms
106,060 KB
testcase_16 AC 178 ms
114,628 KB
testcase_17 AC 96 ms
78,508 KB
testcase_18 AC 122 ms
92,020 KB
testcase_19 AC 167 ms
111,532 KB
testcase_20 AC 139 ms
99,644 KB
testcase_21 AC 93 ms
76,628 KB
testcase_22 AC 167 ms
109,292 KB
testcase_23 AC 170 ms
108,040 KB
testcase_24 AC 169 ms
106,364 KB
testcase_25 AC 74 ms
71,628 KB
testcase_26 AC 73 ms
71,560 KB
testcase_27 AC 143 ms
100,036 KB
testcase_28 AC 107 ms
85,184 KB
testcase_29 AC 114 ms
87,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
*a, =map(int,input().split())
a=sorted(a)

# dry
l=0
r=2*n-1
dry=0
while r-l>0:
    #print(l,r)
    if a[l]+a[r]<0:
        dry+=1
        l+=1
        r-=1
    else:
        r-=1
    if l>2*n-1 or r<0:
        break

# wet
wet=0
l=0
r=2*n-1
while r-l>0:
    #print(l,r)
    if a[l]+a[r]>0:
        wet+=1
        l+=1
        r-=1
    else:
        l+=1
    if l>2*n-1 or r<0:
        break

# moist
moist=0
l=0
r=2*n-1
while r-l>0:
    if a[l]+a[r]==0:
        moist+=1
        l+=1
        r-=1
    elif abs(a[l])>abs(a[r]):
        l+=1
    elif abs(a[l])<abs(a[r]):
        r-=1
    else:
        break
print(dry,wet,moist)
0