結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー souta-1326souta-1326
提出日時 2021-03-31 21:10:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 427 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 86,940 KB
実行使用メモリ 90,516 KB
最終ジャッジ日時 2023-08-21 21:28:36
合計ジャッジ時間 2,832 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,332 KB
testcase_01 AC 72 ms
71,340 KB
testcase_02 AC 71 ms
71,352 KB
testcase_03 AC 78 ms
71,076 KB
testcase_04 AC 94 ms
90,516 KB
testcase_05 AC 73 ms
71,452 KB
testcase_06 AC 75 ms
71,180 KB
testcase_07 AC 93 ms
88,772 KB
testcase_08 AC 94 ms
88,964 KB
testcase_09 AC 94 ms
89,052 KB
testcase_10 AC 73 ms
71,452 KB
testcase_11 AC 74 ms
71,440 KB
testcase_12 AC 73 ms
71,440 KB
testcase_13 AC 72 ms
71,080 KB
testcase_14 AC 74 ms
71,288 KB
testcase_15 AC 73 ms
71,396 KB
testcase_16 AC 75 ms
71,308 KB
testcase_17 AC 73 ms
71,296 KB
testcase_18 AC 74 ms
71,336 KB
testcase_19 AC 74 ms
71,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,X,Y=map(int,input().split())
A=sorted(list(map(int,input().split())))
ans=sum(A)
need = N-M
for i in range(N):
    if A[i] <= Y:
        ans -= A[i]
        need-=1
    elif A[i]>=X:
        if need<=0:
            print(ans);exit()
        print("Handicapped");exit()
    else:
        if need<=0:
            print(ans);exit()
        ans -= A[i]
        need-=1
        if need<=0:
            print(ans);exit()
print(0)
0