結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー arashinarashin
提出日時 2021-03-31 22:01:59
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 660 bytes
コンパイル時間 1,674 ms
コンパイル使用メモリ 170,644 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-22 01:51:25
合計ジャッジ時間 2,640 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 32 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 27 ms
4,376 KB
testcase_08 AC 24 ms
4,380 KB
testcase_09 AC 25 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using u64 = uint_least64_t;
using s64 = int_least64_t;
using ll = uint_least64_t;

int main(){
	u64 n,m,x,y;

	cin >> n >> m >> x >> y;
	vector<u64> a;
    for (int i = 0; i < n; i++){
		int aa;
		cin >> aa;
		if (aa > y){
			a.push_back(aa);
		}
	}
	// if (a.size() <= m){
	// 	cout << "Handicapped" << endl;
	// 	return 0;
	// }
	sort(a.begin(),a.end());
	u64 ans = 0;
	int lim = a.size()-m;
	if (lim < 0) lim = 0;
	for (int i = a.size()-1; i >= lim; i--){
		ans += a[i];
	}
	if (a.size() > m){
		if (a[a.size()-m-1] >= x){
			cout << "Handicapped" << endl;
			return 0;
		}
	}
	cout << ans << endl;
	return 0;
}
0