結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー Amemamenonisemono
提出日時 2021-03-31 21:25:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 569 bytes
コンパイル時間 799 ms
コンパイル使用メモリ 71,068 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-15 14:58:20
合計ジャッジ時間 1,517 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 10 WA * 6
権限があれば一括ダウンロードができます

ソースコード

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(n-m<countx){
		cout << "Handicapped" << endl;
	}
	else
	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