結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー yuusanlondonyuusanlondon
提出日時 2021-01-22 21:44:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 305 ms / 2,000 ms
コード長 514 bytes
コンパイル時間 482 ms
コンパイル使用メモリ 86,720 KB
実行使用メモリ 76,976 KB
最終ジャッジ日時 2023-08-27 18:24:05
合計ジャッジ時間 12,761 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,124 KB
testcase_01 AC 70 ms
70,788 KB
testcase_02 AC 69 ms
71,100 KB
testcase_03 AC 70 ms
70,932 KB
testcase_04 AC 68 ms
71,036 KB
testcase_05 AC 70 ms
71,164 KB
testcase_06 AC 68 ms
71,016 KB
testcase_07 AC 68 ms
71,108 KB
testcase_08 AC 70 ms
71,044 KB
testcase_09 AC 68 ms
71,132 KB
testcase_10 AC 70 ms
71,260 KB
testcase_11 AC 69 ms
71,240 KB
testcase_12 AC 70 ms
71,076 KB
testcase_13 AC 70 ms
71,096 KB
testcase_14 AC 78 ms
75,680 KB
testcase_15 AC 79 ms
75,812 KB
testcase_16 AC 70 ms
70,896 KB
testcase_17 AC 78 ms
75,896 KB
testcase_18 AC 69 ms
71,024 KB
testcase_19 AC 88 ms
76,120 KB
testcase_20 AC 79 ms
75,944 KB
testcase_21 AC 70 ms
70,796 KB
testcase_22 AC 82 ms
76,412 KB
testcase_23 AC 104 ms
76,976 KB
testcase_24 AC 128 ms
76,620 KB
testcase_25 AC 301 ms
76,772 KB
testcase_26 AC 88 ms
76,428 KB
testcase_27 AC 85 ms
76,124 KB
testcase_28 AC 301 ms
76,844 KB
testcase_29 AC 95 ms
76,312 KB
testcase_30 AC 103 ms
76,796 KB
testcase_31 AC 104 ms
76,736 KB
testcase_32 AC 89 ms
76,320 KB
testcase_33 AC 301 ms
76,776 KB
testcase_34 AC 300 ms
76,940 KB
testcase_35 AC 302 ms
76,848 KB
testcase_36 AC 305 ms
76,648 KB
testcase_37 AC 302 ms
76,664 KB
testcase_38 AC 302 ms
76,764 KB
testcase_39 AC 303 ms
76,852 KB
testcase_40 AC 304 ms
76,792 KB
testcase_41 AC 300 ms
76,740 KB
testcase_42 AC 302 ms
76,676 KB
testcase_43 AC 70 ms
71,004 KB
testcase_44 AC 298 ms
76,896 KB
testcase_45 AC 69 ms
71,176 KB
testcase_46 AC 303 ms
76,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
b=[]
for _ in range(n):
  b.append(list(map(int,input().split())))
maxscore=a[0]
bestans=1
for i in range(2**n):
  bells=[]
  for j in range(n):
    if 1<<j&i:
      bells.append(j)
  ans=0
  for j in range(len(bells)):
    ans+=a[bells[j]]
    for k in range(j+1,len(bells)):
      ans+=b[bells[j]][bells[k]]
  if ans>maxscore:
    maxscore=ans
    bestans=i
print(maxscore)
ans=[]
for i in range(n):
  if 1<<i&bestans:
    ans.append(str(i+1))
print(' '.join(ans))
0