結果
| 問題 | 
                            No.1454 ツブ消ししとるなEasy
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Amemamenonisemono
                         | 
                    
| 提出日時 | 2021-03-31 21:30:50 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 573 bytes | 
| コンパイル時間 | 934 ms | 
| コンパイル使用メモリ | 69,248 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-15 15:24:39 | 
| 合計ジャッジ時間 | 1,707 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 14 WA * 2 | 
ソースコード
#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;
}
            
            
            
        
            
Amemamenonisemono