結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー 斎藤健太斎藤健太
提出日時 2021-03-31 21:31:03
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 1,588 bytes
コンパイル時間 2,200 ms
コンパイル使用メモリ 170,956 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-21 23:32:59
合計ジャッジ時間 2,671 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 33 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 26 ms
4,380 KB
testcase_08 AC 27 ms
4,384 KB
testcase_09 AC 26 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <map>
#include <math.h>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
using namespace std;
using ll = long long;
const ll dx[4] = {1,0,-1,0};
const ll dy[4] = {0,1,0,-1};
ll mod(ll x, ll m){return x & m;}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n, ll m) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % m;
        a = a * a % m;
        n >>= 1;
    }
    return res;
}
ll yaku(ll x){
    ll cnt = 0;
    for(int i = 1; i * i <= x; i++){
        if(x % i == 0){
            if(i == x / i) cnt++;
            else cnt += 2;
        }
    }
    return cnt;
}
ll modwaru(ll a, ll b, ll m){
    a %= m;
    return a * modinv(b, m) % m;
}
ll gcd(ll x, ll y){
    if(x % y == 0)return y;
    else return gcd(y, x % y); 
}

int main(){
    ll N, M, X, Y, ans = 0, gen;
    cin >> N >> M >> X >> Y;
    vector<ll> A(N);
    gen = N;
    bool b = true;
    for(int i = 0; i < N; i++){
        cin >> A[i];
        ans += A[i];
    }
    sort(A.begin(), A.end());
    for(int i = 0; i < N; i++){
        if(A[i] <= Y){
            ans -= A[i];
            gen--;
            continue;
        }
        if(A[i] >= X) continue;
        if(gen > M){
            ans -= A[i];
            gen--;
        } 
    }
    if(gen > M) cout << "Handicapped" << endl;
    else cout << ans << endl;
}
0