結果
| 問題 |
No.1454 ツブ消ししとるなEasy
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-31 21:31:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 34 ms / 2,000 ms |
| コード長 | 1,588 bytes |
| コンパイル時間 | 2,098 ms |
| コンパイル使用メモリ | 172,812 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-15 15:25:07 |
| 合計ジャッジ時間 | 2,832 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 |
ソースコード
#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;
}