結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long

signed main(){
  int n,m,x,y;cin>>n>>m>>x>>y;
  int a[n];
  int cnt=0;
  rep(i,n){
    cin>>a[i];
    if(a[i]>=x) cnt++;
  }
  if(cnt>m){
    cout<<"Handicapped"<<endl;
    return 0;
  }
  sort(a,a+n);
  cnt=0;
  int ans=0;
  rep(i,n){
    if(a[i]<=y){
      cnt++;
      continue;
    }
    if(cnt<(n-m)){
      cnt++;
      continue;
    }
    ans+=a[i];
  }
  cout<<ans<<endl;
  return 0;
}
0