結果
| 問題 | No.1360 [Zelkova 4th Tune] 協和音 |
| コンテスト | |
| ユーザー |
lllllll88938494
|
| 提出日時 | 2022-01-12 23:37:59 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 669 bytes |
| 記録 | |
| コンパイル時間 | 1,352 ms |
| コンパイル使用メモリ | 81,944 KB |
| 実行使用メモリ | 76,180 KB |
| 最終ジャッジ日時 | 2024-11-15 16:44:26 |
| 合計ジャッジ時間 | 9,301 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 44 WA * 3 |
ソースコード
from itertools import product
n=int(input())
ns=list(map(int,input().split()))
bs=[list(map(int,input().split())) for i in range(n)]
ans=0
anss=[]
for p in product([0,1],repeat=n):
cnt=0
cntb=[]
for i in range(len(p)):
if p[i] == 1:
cnt+= ns[i]
cntb.append(i)
if len(cntb) <= 1:
if ans < cnt:
ans = cnt
anss = cntb
continue
for i in range(len(cntb)-1):
for j in range(i+1,len(cntb)):
cnt += bs[cntb[i]][cntb[j]]
if ans < cnt:
ans = cnt
anss = cntb
print(ans)
anss=list(map(lambda x:x+1,anss))
print(*anss)
lllllll88938494