結果

問題 No.1046 Fruits Rush
ユーザー 👑 tamatotamato
提出日時 2020-05-08 21:22:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 379 bytes
コンパイル時間 499 ms
コンパイル使用メモリ 87,548 KB
実行使用メモリ 71,972 KB
最終ジャッジ日時 2023-09-17 00:57:25
合計ジャッジ時間 2,506 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,780 KB
testcase_01 AC 65 ms
71,488 KB
testcase_02 AC 68 ms
71,484 KB
testcase_03 AC 66 ms
71,972 KB
testcase_04 AC 66 ms
71,492 KB
testcase_05 AC 63 ms
71,856 KB
testcase_06 AC 66 ms
71,852 KB
testcase_07 AC 66 ms
71,592 KB
testcase_08 AC 64 ms
71,928 KB
testcase_09 AC 62 ms
71,904 KB
testcase_10 AC 65 ms
71,768 KB
testcase_11 AC 65 ms
71,636 KB
testcase_12 AC 67 ms
71,896 KB
testcase_13 AC 67 ms
71,804 KB
testcase_14 AC 67 ms
71,732 KB
testcase_15 AC 67 ms
71,688 KB
testcase_16 AC 66 ms
71,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort(reverse=True)
    ans = 0
    for k in range(K):
        if A[k] > 0:
            ans += A[k]
    if ans != 0:
        print(ans)
    else:
        print(A[0])


if __name__ == '__main__':
    main()
0