結果

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

ソースコード

diff #

import sys
input = sys.stdin.readline

N,M,X,Y=map(int,input().split())
A=list(map(int,input().split()))
B=[]
C=[]

for a in A:
    if a>=X:
        C.append(a)
    elif a>Y:
        B.append(a)

if len(C)>M:
    print("Handicapped")
    exit()

rest=M-len(C)
B.sort(reverse=True)
B=B[:rest]

print(sum(C)+sum(B))
0