結果
問題 | No.1454 ツブ消ししとるなEasy |
ユーザー |
|
提出日時 | 2021-03-31 21:27:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 33 ms / 2,000 ms |
コード長 | 573 bytes |
コンパイル時間 | 2,356 ms |
コンパイル使用メモリ | 173,248 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-15 15:10:04 |
合計ジャッジ時間 | 2,747 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll n,m,x,y; cin >> n >> m >> x >> y; ll wa = 0; ll k = 0; vector<ll> a; for(int i = 0;i < n;i++){ ll in; cin >> in; if(in >= x)wa += in,k++; else if(in > y){ a.push_back(in); } } if(k > m){ cout << "Handicapped" << endl; return 0; } sort(a.rbegin(),a.rend()); for(int i = 0;i < a.size();i++){ if(k >= m)break; k++; wa += a[i]; } cout << wa << endl; }