結果

問題 No.1861 Required Number
ユーザー tailstails
提出日時 2022-11-04 16:57:25
言語 cLay
(20240104-1)
結果
AC  
実行時間 26 ms / 2,500 ms
コード長 369 bytes
コンパイル時間 2,117 ms
コンパイル使用メモリ 163,172 KB
実行使用メモリ 13,204 KB
最終ジャッジ日時 2023-09-25 19:43:45
合計ジャッジ時間 7,720 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 26 ms
13,204 KB
testcase_04 AC 25 ms
13,188 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,384 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,384 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 9 ms
6,652 KB
testcase_25 AC 18 ms
11,848 KB
testcase_26 AC 5 ms
4,744 KB
testcase_27 AC 8 ms
6,336 KB
testcase_28 AC 9 ms
7,096 KB
testcase_29 AC 7 ms
5,312 KB
testcase_30 AC 3 ms
4,376 KB
testcase_31 AC 19 ms
11,980 KB
testcase_32 AC 3 ms
4,380 KB
testcase_33 AC 13 ms
9,472 KB
testcase_34 AC 16 ms
10,308 KB
testcase_35 AC 16 ms
10,424 KB
testcase_36 AC 7 ms
5,496 KB
testcase_37 AC 8 ms
6,668 KB
testcase_38 AC 15 ms
10,640 KB
testcase_39 AC 10 ms
7,412 KB
testcase_40 AC 19 ms
11,928 KB
testcase_41 AC 17 ms
11,540 KB
testcase_42 AC 14 ms
10,040 KB
testcase_43 AC 8 ms
6,808 KB
testcase_44 AC 2 ms
4,380 KB
04_evil_1.txt RE -
04_evil_2.txt RE -
04_evil_3.txt RE -
04_evil_4.txt RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

ll@n,@k,@a[n];
char dpl[n+1][k+1]{},dpr[k+1]{};
dpl[0][0]=1;
rep(i,n){
	rep(j,k+1){
		dpl[i+1][j]=dpl[i][j];
		if(j-a[i]>=0){
			dpl[i+1][j]|=dpl[i][j-a[i]];
		}
	}
}
if(!dpl[n][k]){
	wt(-1);
	exit(0);
}
dpr[0]=1;
ll z=n;
rrep(i,n){
	rep(j,k+1){
		if(dpl[i][j]&&dpr[k-j]){
			--z;
			break;
		}
	}
	rrep(j,k+1){
		if(j-a[i]>=0){
			dpr[j]|=dpr[j-a[i]];
		}
	}
}
wt(z);
0