結果
問題 | No.1454 ツブ消ししとるなEasy |
ユーザー |
![]() |
提出日時 | 2024-11-25 00:35:14 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 34 ms / 2,000 ms |
コード長 | 650 bytes |
コンパイル時間 | 3,263 ms |
コンパイル使用メモリ | 256,144 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-25 00:35:19 |
合計ジャッジ時間 | 4,578 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { int n, m, x, y; cin >> n >> m >> x >> y; vector<int> a(n); rep(i, n) cin >> a[i]; sort(a.rbegin(), a.rend()); while (!a.empty() && a.back() <= y) a.pop_back(); while (!a.empty() && a.size() > m && a.back() < x) a.pop_back(); if (a.back() >= x && a.size() > m) { cout << "Handicapped" << endl; } else { cout << accumulate(a.begin(), a.end(), 0LL) << endl; } return 0; }