結果

問題 No.190 Dry Wet Moist
ユーザー mkawa2mkawa2
提出日時 2020-01-27 23:26:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 234 ms / 2,000 ms
コード長 750 bytes
コンパイル時間 1,070 ms
コンパイル使用メモリ 10,676 KB
実行使用メモリ 31,052 KB
最終ジャッジ日時 2023-10-12 18:04:47
合計ジャッジ時間 5,288 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,712 KB
testcase_01 AC 15 ms
7,888 KB
testcase_02 AC 15 ms
7,824 KB
testcase_03 AC 15 ms
7,808 KB
testcase_04 AC 15 ms
7,704 KB
testcase_05 AC 15 ms
7,824 KB
testcase_06 AC 15 ms
7,892 KB
testcase_07 AC 16 ms
8,160 KB
testcase_08 AC 16 ms
8,296 KB
testcase_09 AC 15 ms
7,724 KB
testcase_10 AC 16 ms
7,736 KB
testcase_11 AC 16 ms
7,776 KB
testcase_12 AC 105 ms
17,376 KB
testcase_13 AC 130 ms
19,716 KB
testcase_14 AC 104 ms
17,276 KB
testcase_15 AC 140 ms
20,476 KB
testcase_16 AC 174 ms
23,136 KB
testcase_17 AC 34 ms
9,960 KB
testcase_18 AC 87 ms
15,060 KB
testcase_19 AC 176 ms
23,004 KB
testcase_20 AC 122 ms
18,924 KB
testcase_21 AC 28 ms
9,304 KB
testcase_22 AC 227 ms
30,012 KB
testcase_23 AC 184 ms
31,052 KB
testcase_24 AC 234 ms
30,132 KB
testcase_25 AC 16 ms
7,816 KB
testcase_26 AC 15 ms
7,836 KB
testcase_27 AC 130 ms
22,708 KB
testcase_28 AC 65 ms
14,648 KB
testcase_29 AC 80 ms
15,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))

def main():
    n = II()
    aa = LI()
    aa.sort()

    neg = 0
    i, j = 0, 2 * n - 1
    while i < j:
        if aa[i] + aa[j] < 0:
            neg += 1
            i, j = i + 1, j - 1
        else: j -= 1

    pos = 0
    i, j = 0, 2 * n - 1
    while i < j:
        if aa[i] + aa[j] > 0:
            pos += 1
            i, j = i + 1, j - 1
        else: i += 1

    equ = 0
    i, j = 0, 2 * n - 1
    while i < j:
        if aa[i] + aa[j] == 0:
            equ += 1
            i, j = i + 1, j - 1
        elif aa[i] + aa[j] > 0: j -= 1
        else: i += 1

    print(neg, pos, equ)

main()
0