結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー netyo715netyo715
提出日時 2021-03-31 21:08:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 355 bytes
コンパイル時間 589 ms
コンパイル使用メモリ 10,740 KB
実行使用メモリ 19,548 KB
最終ジャッジ日時 2023-08-21 19:15:52
合計ジャッジ時間 1,862 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,976 KB
testcase_01 AC 16 ms
8,012 KB
testcase_02 AC 16 ms
7,848 KB
testcase_03 AC 16 ms
7,852 KB
testcase_04 AC 75 ms
19,548 KB
testcase_05 AC 16 ms
7,852 KB
testcase_06 AC 16 ms
8,040 KB
testcase_07 AC 66 ms
19,148 KB
testcase_08 AC 50 ms
19,128 KB
testcase_09 AC 51 ms
19,192 KB
testcase_10 AC 16 ms
7,844 KB
testcase_11 AC 16 ms
7,804 KB
testcase_12 AC 16 ms
8,188 KB
testcase_13 AC 16 ms
7,860 KB
testcase_14 AC 16 ms
8,224 KB
testcase_15 AC 16 ms
7,820 KB
testcase_16 AC 17 ms
8,292 KB
testcase_17 AC 16 ms
7,968 KB
testcase_18 AC 16 ms
7,852 KB
testcase_19 AC 15 ms
7,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, X, Y = map(int, input().split())
A = list(map(int, input().split()))

b = []
cnt = 0
ans = 0
for a in A:
    if a <= Y:
        continue
    if a >= X:
        ans += a
        cnt += 1
    else:
        b.append(a)

if cnt > M:
    print("Handicapped")
    exit()
b.sort(reverse=True)
t = M-cnt
if t:
    ans += sum(b[:min(t, len(b))])

print(ans)
0