結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー googol_S0googol_S0
提出日時 2021-03-31 21:06:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 96,412 KB
最終ジャッジ日時 2023-08-21 19:12:00
合計ジャッジ時間 2,810 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,428 KB
testcase_01 AC 71 ms
71,116 KB
testcase_02 AC 71 ms
71,452 KB
testcase_03 AC 73 ms
71,376 KB
testcase_04 AC 102 ms
96,412 KB
testcase_05 AC 71 ms
71,300 KB
testcase_06 AC 71 ms
71,136 KB
testcase_07 AC 96 ms
93,884 KB
testcase_08 AC 95 ms
88,448 KB
testcase_09 AC 95 ms
88,344 KB
testcase_10 AC 71 ms
71,332 KB
testcase_11 AC 71 ms
71,368 KB
testcase_12 AC 72 ms
71,436 KB
testcase_13 AC 75 ms
71,332 KB
testcase_14 AC 74 ms
71,544 KB
testcase_15 AC 73 ms
71,368 KB
testcase_16 AC 74 ms
71,400 KB
testcase_17 AC 73 ms
71,116 KB
testcase_18 AC 71 ms
71,120 KB
testcase_19 AC 73 ms
71,472 KB
権限があれば一括ダウンロードができます

ソースコード

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