結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー ryusukeryusuke
提出日時 2023-07-09 22:55:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 557 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 10,780 KB
実行使用メモリ 19,652 KB
最終ジャッジ日時 2023-10-01 02:59:48
合計ジャッジ時間 1,659 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,828 KB
testcase_01 AC 16 ms
8,140 KB
testcase_02 AC 16 ms
7,924 KB
testcase_03 AC 16 ms
7,884 KB
testcase_04 AC 53 ms
19,652 KB
testcase_05 AC 16 ms
7,776 KB
testcase_06 AC 15 ms
8,100 KB
testcase_07 AC 48 ms
18,456 KB
testcase_08 AC 45 ms
18,400 KB
testcase_09 AC 44 ms
18,464 KB
testcase_10 AC 16 ms
7,780 KB
testcase_11 AC 16 ms
7,820 KB
testcase_12 AC 16 ms
8,140 KB
testcase_13 AC 16 ms
7,772 KB
testcase_14 AC 16 ms
8,300 KB
testcase_15 AC 16 ms
7,952 KB
testcase_16 AC 16 ms
8,260 KB
testcase_17 AC 17 ms
7,780 KB
testcase_18 AC 16 ms
7,772 KB
testcase_19 AC 15 ms
7,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# verification-helper: PROBLEM https://yukicoder.me/problems/no/1454

def main() -> None:
    n, m, x, y = map(int, input().split())
    a = list(map(int, input().split()))

    
    p = []
    for i in range(n):
        if a[i] <= y:
            continue
        p.append(a[i])
    
    n = len(p)
    if n <= m:
        print(sum(p))
    else:
        p.sort()
        for i in range(n - m):
            if p[i] >= x:
                exit(print("Handicapped"))
        p.sort(reverse=True)
        print(sum(p[:m]))


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