結果
問題 | No.1454 ツブ消ししとるなEasy |
ユーザー |
|
提出日時 | 2021-03-31 21:45:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 18 ms / 2,000 ms |
コード長 | 761 bytes |
コンパイル時間 | 2,987 ms |
コンパイル使用メモリ | 197,968 KB |
最終ジャッジ日時 | 2025-01-20 03:06:18 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
/** * author: shu8Cream * created: 31.03.2021 21:33:39 **/ #include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int i=0; i<(n); i++) #define all(x) (x).begin(), (x).end() using ll = long long; using P = pair<int,int>; using vi = vector<ll>; using vvi = vector<vi>; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); ll n,m,x,y; cin >> n >> m >> x >> y; vi a(n); rep(i,n) cin >> a[i]; sort(all(a)); auto itr1 = lower_bound(all(a), y+1) - a.begin(); auto itr2 = lower_bound(all(a), x) - a.begin(); ll ans = 0; if(n-itr2>m){ cout << "Handicapped" << endl; return 0; } rep(i,m){ if(n-1-i<itr1) break; ans+=a[n-1-i]; } cout << ans << endl; }