結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー U SU S
提出日時 2021-01-22 21:51:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 500 ms / 2,000 ms
コード長 821 bytes
コンパイル時間 242 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 78,644 KB
最終ジャッジ日時 2023-08-27 18:39:32
合計ジャッジ時間 16,715 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
73,132 KB
testcase_01 AC 109 ms
73,256 KB
testcase_02 AC 109 ms
72,892 KB
testcase_03 AC 108 ms
72,964 KB
testcase_04 AC 107 ms
72,936 KB
testcase_05 AC 104 ms
73,000 KB
testcase_06 AC 108 ms
72,760 KB
testcase_07 AC 107 ms
72,892 KB
testcase_08 AC 107 ms
73,068 KB
testcase_09 AC 108 ms
72,996 KB
testcase_10 AC 109 ms
72,900 KB
testcase_11 AC 108 ms
73,132 KB
testcase_12 AC 107 ms
72,892 KB
testcase_13 AC 107 ms
73,160 KB
testcase_14 AC 119 ms
77,988 KB
testcase_15 AC 118 ms
78,232 KB
testcase_16 AC 113 ms
77,616 KB
testcase_17 AC 119 ms
77,944 KB
testcase_18 AC 108 ms
73,040 KB
testcase_19 AC 118 ms
77,992 KB
testcase_20 AC 117 ms
78,216 KB
testcase_21 AC 109 ms
73,120 KB
testcase_22 AC 119 ms
78,252 KB
testcase_23 AC 145 ms
78,344 KB
testcase_24 AC 171 ms
78,296 KB
testcase_25 AC 496 ms
78,472 KB
testcase_26 AC 122 ms
77,992 KB
testcase_27 AC 126 ms
78,244 KB
testcase_28 AC 493 ms
78,644 KB
testcase_29 AC 131 ms
78,092 KB
testcase_30 AC 144 ms
78,496 KB
testcase_31 AC 146 ms
78,396 KB
testcase_32 AC 127 ms
78,280 KB
testcase_33 AC 497 ms
78,544 KB
testcase_34 AC 498 ms
78,512 KB
testcase_35 AC 496 ms
78,396 KB
testcase_36 AC 496 ms
78,552 KB
testcase_37 AC 496 ms
78,524 KB
testcase_38 AC 495 ms
78,280 KB
testcase_39 AC 497 ms
78,276 KB
testcase_40 AC 499 ms
78,544 KB
testcase_41 AC 500 ms
78,400 KB
testcase_42 AC 498 ms
78,592 KB
testcase_43 AC 107 ms
73,320 KB
testcase_44 AC 500 ms
78,284 KB
testcase_45 AC 108 ms
72,904 KB
testcase_46 AC 495 ms
78,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import sys
# input = sys.stdin.readline
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))
import math
import bisect
from copy import deepcopy as dc
from itertools import accumulate
from collections import Counter, defaultdict, deque
def ceil(U,V):return (U+V-1)//V
def modf1(N,MOD):return (N-1)%MOD+1

n = int(input())
a = lmp()
grid = []
for i in range(n):
    b = lmp()
    grid.append(b)
ans = 0
ans_a = 0
for i in range(2**n):
    cnt = 0
    for j in range(n):
        if i & 1 << j:
            cnt += a[j]
            for k in range(j+1, n):
                if i & 1 << k:
                    cnt += grid[j][k]
    if ans <= cnt:
        ans = cnt
        ans_a = i
print(ans)
ans_n = []
for i in range(n):
    if ans_a & 1 << i:
        ans_n.append(i+1)
print(*ans_n)



0