結果

問題 No.190 Dry Wet Moist
ユーザー fmhrfmhr
提出日時 2015-04-23 17:28:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 272 ms / 2,000 ms
コード長 1,215 bytes
コンパイル時間 70 ms
コンパイル使用メモリ 10,980 KB
実行使用メモリ 32,212 KB
最終ジャッジ日時 2023-09-18 08:35:25
合計ジャッジ時間 4,358 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,292 KB
testcase_01 AC 16 ms
8,288 KB
testcase_02 AC 16 ms
8,128 KB
testcase_03 AC 16 ms
8,312 KB
testcase_04 AC 16 ms
8,264 KB
testcase_05 AC 17 ms
8,200 KB
testcase_06 AC 16 ms
8,296 KB
testcase_07 AC 19 ms
8,308 KB
testcase_08 AC 17 ms
8,352 KB
testcase_09 AC 16 ms
8,200 KB
testcase_10 AC 16 ms
8,312 KB
testcase_11 AC 16 ms
8,172 KB
testcase_12 AC 124 ms
17,592 KB
testcase_13 AC 160 ms
19,696 KB
testcase_14 AC 121 ms
17,180 KB
testcase_15 AC 170 ms
20,884 KB
testcase_16 AC 221 ms
24,240 KB
testcase_17 AC 38 ms
9,964 KB
testcase_18 AC 104 ms
15,244 KB
testcase_19 AC 212 ms
24,224 KB
testcase_20 AC 148 ms
18,872 KB
testcase_21 AC 31 ms
9,432 KB
testcase_22 AC 272 ms
32,212 KB
testcase_23 AC 246 ms
31,244 KB
testcase_24 AC 262 ms
29,968 KB
testcase_25 AC 16 ms
8,120 KB
testcase_26 AC 16 ms
8,200 KB
testcase_27 AC 158 ms
23,808 KB
testcase_28 AC 73 ms
14,668 KB
testcase_29 AC 92 ms
15,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding:utf-8




N = int(input())
A = list(map(int, input().split()))
A = sorted(A)

def dry():
    meterials = list(A)
    i = 0
    j = len(meterials)-1
    count = 0
    while i < j and count < N:
        # print(i, j)
        mixture = meterials[i] + meterials[j]
        if mixture < 0:
            i += 1
            j -= 1
            count += 1
        elif mixture == 0:
            j -= 1
        elif mixture > 0:
            j -= 1
    return count

def wet():
    meterials = list(A)
    i = 0
    j = len(meterials)-1
    count = 0
    while i < j and count < N:
        mixture = meterials[i] + meterials[j]
        if mixture < 0:
            i += 1
        elif mixture == 0:
            i += 1
        elif mixture > 0:
            j -= 1
            i += 1
            count += 1
    return count

def moist():
    meterials = list(A)
    i = 0
    j = len(meterials)-1
    count = 0
    while i < j and count < N:
        mixture = meterials[i] + meterials[j]
        if mixture < 0:
            i += 1
        elif mixture > 0:
            j -= 1
        elif mixture == 0:
            i += 1
            j -= 1
            count += 1
    return count

# print(A)
print(dry(), wet(), moist())
0