結果
問題 | No.1454 ツブ消ししとるなEasy |
ユーザー |
|
提出日時 | 2021-03-15 23:56:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 36 ms / 2,000 ms |
コード長 | 474 bytes |
コンパイル時間 | 2,014 ms |
コンパイル使用メモリ | 173,548 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-22 21:05:18 |
合計ジャッジ時間 | 3,473 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#include <bits/stdc++.h> using namespace std;using ll=long long; int main() { ll n,m,x,y,cnt=0; vector<ll>v; cin>>n>>m>>x>>y; for(int i=0;i<n;i++) { ll a; cin>>a; if (a>y)v.push_back(a); if (a>=x)cnt++; } if (cnt>m) { cout<<"Handicapped"<<endl;return 0; } sort(v.rbegin(),v.rend()); ll ans=0; for (int i=0;i<min(m,(ll)v.size());i++) { ans+=v[i]; } cout<<ans<<endl; }