結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー AmemamenonisemonoAmemamenonisemono
提出日時 2021-03-31 21:30:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 573 bytes
コンパイル時間 931 ms
コンパイル使用メモリ 69,248 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-09 05:32:04
合計ジャッジ時間 2,226 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

int main() {
	// your code goes here
	int n,m,x,y;
	cin >> n >> m >> x >> y;
	int a[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	sort(a,a+n);
	int countx=0;
	int county=0;
	for(int i=0;i<n;i++){
		if(a[i]<=y){
			county++;
		}
		else break;
	}
	for(int i=n-1;i>0;i--){
		if(a[i]>=x){
			countx++;
		}
		else break;
	}
	if(m<countx){
		cout << "Handicapped" << endl;
		return 0;
	}
	if(n-county<m){
		m=n-county;
	}
	int sum=0;
	for(int i=n-1;i>n-m-1;i--){
		sum=sum+a[i];
	}
	cout << sum << endl;
	return 0;
}
0