結果
問題 |
No.1454 ツブ消ししとるなEasy
|
ユーザー |
|
提出日時 | 2025-03-20 10:39:46 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 680 bytes |
コンパイル時間 | 3,326 ms |
コンパイル使用メモリ | 280,468 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-20 10:39:52 |
合計ジャッジ時間 | 4,638 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i) #define all(a) (a).begin(),(a).end() int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int N, M, X, Y; cin >> N >> M >> X >> Y; vector<int> A(N); rep(i, 0, N) cin >> A[i]; sort(all(A)); int mini = upper_bound(all(A), Y) - A.begin(); int maxi = lower_bound(all(A), X) - A.begin(); if (N - maxi > M) { cout << "Handicapped\n"; return 0; } int ind = max(mini, N - M); ll ans = 0; rep(i, ind, N) ans += A[i]; cout << ans << '\n'; }