結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
  ll n, m, x, y;
  cin >> n >> m >> x >> y;
  
  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  
  sort(a.rbegin(), a.rend());
  
  if (m < n && a.at(m) >= x) {
    cout << "Handicapped\n";
    return 0;
  }
  
  ll ans = 0;
  for (int i = 0; i < m; i++) {
    if (a.at(i) <= y) break;
    ans += a.at(i);
  }
  
  cout << ans << '\n';
}
0