結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー tailstails
提出日時 2021-01-22 23:31:25
言語 cLay
(20240104-1)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 404 bytes
コンパイル時間 2,262 ms
コンパイル使用メモリ 163,088 KB
実行使用メモリ 6,668 KB
最終ジャッジ日時 2023-09-19 02:04:34
合計ジャッジ時間 8,604 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,400 KB
testcase_01 AC 2 ms
5,472 KB
testcase_02 AC 2 ms
5,460 KB
testcase_03 AC 2 ms
5,400 KB
testcase_04 AC 2 ms
5,372 KB
testcase_05 AC 2 ms
5,360 KB
testcase_06 AC 2 ms
5,380 KB
testcase_07 AC 2 ms
5,400 KB
testcase_08 AC 2 ms
5,432 KB
testcase_09 AC 2 ms
5,468 KB
testcase_10 AC 2 ms
5,592 KB
testcase_11 AC 2 ms
5,416 KB
testcase_12 AC 2 ms
5,536 KB
testcase_13 AC 2 ms
5,436 KB
testcase_14 AC 2 ms
5,640 KB
testcase_15 AC 2 ms
5,364 KB
testcase_16 AC 2 ms
5,424 KB
testcase_17 AC 2 ms
5,472 KB
testcase_18 AC 2 ms
5,380 KB
testcase_19 AC 2 ms
5,460 KB
testcase_20 AC 2 ms
5,372 KB
testcase_21 AC 2 ms
5,388 KB
testcase_22 AC 2 ms
5,388 KB
testcase_23 AC 4 ms
5,772 KB
testcase_24 AC 6 ms
5,728 KB
testcase_25 AC 16 ms
6,668 KB
testcase_26 AC 2 ms
5,448 KB
testcase_27 AC 2 ms
5,412 KB
testcase_28 AC 16 ms
6,496 KB
testcase_29 AC 3 ms
5,464 KB
testcase_30 AC 4 ms
5,532 KB
testcase_31 AC 4 ms
5,700 KB
testcase_32 AC 3 ms
5,672 KB
testcase_33 AC 16 ms
6,476 KB
testcase_34 AC 16 ms
6,432 KB
testcase_35 AC 16 ms
6,404 KB
testcase_36 AC 16 ms
6,412 KB
testcase_37 AC 16 ms
6,380 KB
testcase_38 AC 17 ms
6,460 KB
testcase_39 AC 17 ms
6,408 KB
testcase_40 AC 16 ms
6,608 KB
testcase_41 AC 16 ms
6,456 KB
testcase_42 AC 16 ms
6,500 KB
testcase_43 AC 2 ms
5,504 KB
testcase_44 AC 16 ms
6,484 KB
testcase_45 AC 2 ms
5,576 KB
testcase_46 AC 16 ms
6,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll z=-ll_inf;
ll h[1<<18];
int y;
int n,a[18],b[18][18];

void f(int i,int d,ll s){
	if(d<n){
		f(i,d+1,s);
		if(!(i>>d)){
			ll t=a[d];
			for(int j=0;j<d;++j){
				if(i&1<<j){
					t+=b[d][j];
				}
			}
			h[i]=t;
		}
		s+=h[i&(1<<d)-1];
		i|=1<<d;
		if(z<s){
			z=s;
			y=i;
		}
		f(i,d+1,s);
	}
}

{
	rd(n,a(n),b(n,n));
	f(0,0,0);
	wt(z);
	for(int j=0;j<n;++j){
		if(y&1<<j){
			wtSp(j+1);
		}
	}
}
0