結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー oooooba
提出日時 2021-07-21 22:01:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 881 bytes
コンパイル時間 1,151 ms
コンパイル使用メモリ 117,564 KB
最終ジャッジ日時 2025-01-23 04:07:28
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    int32_t n, m, x, y;
    cin >> n >> m >> x >> y;
    vector<int32_t> as(n);
    for (auto &&a : as) {
        cin >> a;
    }
    sort(as.begin(), as.end());
    for (auto i = 0; i < n; ++i) {
        if (as[i] <= y)
            as[i] = 0;
        else if (as[i] >= x) {
            if (n - i > m) {
                cout << "Handicapped" << endl;
                return 0;
            } else
                break;
        } else if (i < n - m)
            as[i] = 0;
    }
    cout << accumulate(as.begin(), as.end(), int64_t(0)) << endl;
    return 0;
}
0