結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー s1905oss1905os
提出日時 2021-03-31 22:15:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 755 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 31,872 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-09 08:18:27
合計ジャッジ時間 1,026 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 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 AC 13 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 229 ms
5,376 KB
testcase_08 AC 11 ms
5,376 KB
testcase_09 AC 10 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 WA -
testcase_14 AC 1 ms
5,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>

long min(long n, long a[], long memo[]){
	long i;
	long shou = 10000000;
	for(i=0;i<n;i++){
		if(memo[i] != -1) continue;
		if(shou > a[i]){
			shou = a[i];
			memo[i] = a[i];
		}
	}
	return shou;
}

int main(void){
	long n,m,x,y;
	long a[100000];
	long i,memo[100000];
	long long sum = 0;
	scanf("%ld%ld%ld%ld",&n,&m,&x,&y);
	long count = n;
	for(i=0;i<n;i++){
		scanf("%ld",&a[i]);
		memo[i] = -1;
		if(a[i] <= y){
			count--;
			memo[i] = a[i];
			continue;
		}
		if(a[i] >= x) memo[i] = a[i];
		sum += a[i];
	}
	while(m < count){
		long long temp = min(n,a,memo);
		if(temp == 10000000){
			printf("Handicapped\n");
			return 0;
		}
		sum -= temp;
		count--;
		//printf("%d:sum=%d ",temp,sum);
	}
	printf("%lld\n",sum);
	return 0;
}
0