結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー lllllll88938494lllllll88938494
提出日時 2022-01-12 23:37:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 669 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 82,792 KB
実行使用メモリ 76,356 KB
最終ジャッジ日時 2024-04-27 14:11:46
合計ジャッジ時間 8,580 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,960 KB
testcase_01 AC 34 ms
53,500 KB
testcase_02 AC 34 ms
52,604 KB
testcase_03 AC 33 ms
53,688 KB
testcase_04 AC 33 ms
53,264 KB
testcase_05 AC 33 ms
53,156 KB
testcase_06 AC 40 ms
53,532 KB
testcase_07 AC 36 ms
53,136 KB
testcase_08 AC 36 ms
52,476 KB
testcase_09 AC 34 ms
52,572 KB
testcase_10 AC 36 ms
54,020 KB
testcase_11 AC 34 ms
53,112 KB
testcase_12 AC 34 ms
53,464 KB
testcase_13 AC 34 ms
52,992 KB
testcase_14 AC 45 ms
63,044 KB
testcase_15 AC 45 ms
62,508 KB
testcase_16 AC 34 ms
53,764 KB
testcase_17 AC 46 ms
62,736 KB
testcase_18 AC 35 ms
53,204 KB
testcase_19 AC 48 ms
65,148 KB
testcase_20 AC 45 ms
63,112 KB
testcase_21 AC 36 ms
52,712 KB
testcase_22 AC 48 ms
64,028 KB
testcase_23 AC 69 ms
76,080 KB
testcase_24 AC 93 ms
76,020 KB
testcase_25 AC 244 ms
76,092 KB
testcase_26 AC 53 ms
66,876 KB
testcase_27 AC 52 ms
66,224 KB
testcase_28 AC 249 ms
76,356 KB
testcase_29 AC 63 ms
73,900 KB
testcase_30 AC 71 ms
75,944 KB
testcase_31 AC 71 ms
76,052 KB
testcase_32 AC 53 ms
69,840 KB
testcase_33 AC 247 ms
76,176 KB
testcase_34 AC 245 ms
75,888 KB
testcase_35 AC 249 ms
75,940 KB
testcase_36 AC 245 ms
76,140 KB
testcase_37 AC 260 ms
76,228 KB
testcase_38 AC 243 ms
76,308 KB
testcase_39 AC 251 ms
75,948 KB
testcase_40 AC 258 ms
76,092 KB
testcase_41 AC 247 ms
76,028 KB
testcase_42 AC 251 ms
76,024 KB
testcase_43 AC 33 ms
53,088 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
            
0