結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー ryusukeryusuke
提出日時 2023-07-09 22:50:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 723 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 10,880 KB
実行使用メモリ 19,684 KB
最終ジャッジ日時 2023-10-01 02:54:38
合計ジャッジ時間 2,582 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,780 KB
testcase_01 AC 16 ms
7,700 KB
testcase_02 AC 16 ms
7,820 KB
testcase_03 AC 16 ms
7,832 KB
testcase_04 AC 54 ms
19,684 KB
testcase_05 AC 16 ms
7,728 KB
testcase_06 AC 16 ms
7,776 KB
testcase_07 AC 49 ms
18,868 KB
testcase_08 AC 45 ms
18,828 KB
testcase_09 AC 45 ms
18,752 KB
testcase_10 AC 16 ms
7,772 KB
testcase_11 AC 16 ms
7,704 KB
testcase_12 AC 15 ms
7,772 KB
testcase_13 WA -
testcase_14 AC 16 ms
7,760 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 16 ms
7,952 KB
testcase_18 AC 15 ms
7,772 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# verification-helper: PROBLEM https://yukicoder.me/problems/no/1454

def main() -> None:
    n, m, x, y = map(int, input().split())
    a = list(map(int, input().split()))

    p, q = [], []
    for i in range(n):
        if a[i] <= y:
            continue
        if a[i] >= x:
            q.append(a[i])
        else:
            p.append(a[i])
    
    n = len(p)
    q.sort()
    if len(p) + len(q) <= m:
        print(sum(p) + sum(q))
    else:
        over = len(p) + len(q) - m
        r = []
        if over <= len(p):
            for i in range(over):
                r.append(p[i])
            print(sum(p) + sum(q) - sum(r))
        else:
            print("Handicapped")


if __name__ == "__main__":
    main()
0