結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー googol_S0googol_S0
提出日時 2021-03-31 21:06:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 82,592 KB
実行使用メモリ 87,424 KB
最終ジャッジ日時 2024-12-15 09:16:41
合計ジャッジ時間 1,884 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,X,Y=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
B=[]
C=[]
for i in range(N):
  if A[i]<=Y:
    continue
  if A[i]>=X:
    C.append(A[i])
  else:
    B.append(A[i])
if len(C)>M:
  print('Handicapped')
else:
  if len(B)+len(C)<=M:
    print(sum(B)+sum(C))
  else:
    print(sum(C)+sum(B[-(M-len(C)):]))
0