結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー Meso Meso
提出日時 2024-07-03 15:05:59
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 378 bytes
コンパイル時間 125 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 20,876 KB
最終ジャッジ日時 2024-07-03 15:06:04
合計ジャッジ時間 1,668 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, x, y = map(int, input().split())
A = list(map(int, input().split()))

s = [a for a in A if a > y]
s.sort(reverse=True)

ans = []
for i in range(len(s)):
    if s[i] >= x and len(ans) <= m:
        ans.append(s[i])

if len(ans) > m:
    print("Handicapped")
else:
    i = len(ans)
    while i < m and i < len(s):
        ans.append(s[i])
        i += 1

    print(sum(ans))
0