結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-03-31 22:13:27
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 407 bytes
コンパイル時間 529 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 91,788 KB
最終ジャッジ日時 2023-08-22 02:21:50
合計ジャッジ時間 3,335 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,272 KB
testcase_01 AC 69 ms
71,568 KB
testcase_02 AC 72 ms
71,396 KB
testcase_03 AC 68 ms
71,212 KB
testcase_04 AC 92 ms
91,788 KB
testcase_05 AC 69 ms
71,288 KB
testcase_06 AC 69 ms
71,324 KB
testcase_07 AC 90 ms
89,624 KB
testcase_08 AC 96 ms
90,612 KB
testcase_09 AC 95 ms
90,640 KB
testcase_10 AC 68 ms
71,280 KB
testcase_11 AC 68 ms
71,388 KB
testcase_12 AC 67 ms
71,412 KB
testcase_13 AC 69 ms
71,324 KB
testcase_14 AC 69 ms
71,568 KB
testcase_15 AC 69 ms
71,240 KB
testcase_16 AC 69 ms
71,464 KB
testcase_17 AC 71 ms
71,360 KB
testcase_18 AC 71 ms
71,464 KB
testcase_19 AC 71 ms
71,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,x,y = map(int,input().split())
A = sorted(list(map(int,input().split())))
ans = 0
size = 0
for i in range(n)[::-1]:
    if A[i] >= x:
        ans += A[i]
        size += 1
        A.pop()

if size > m:
    print("Handicapped")
    exit()
A = A[::-1]
for i in range(len(A))[::-1]:
    if A[i] <= y:
        A.pop()
A = A[::-1]

while A and size < m:
    size += 1
    ans += A[-1]
    A.pop()
print(ans)
0