結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー U SU S
提出日時 2021-01-22 21:45:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 822 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 78,876 KB
最終ジャッジ日時 2023-08-27 18:30:19
合計ジャッジ時間 17,702 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
73,188 KB
testcase_01 AC 117 ms
72,912 KB
testcase_02 AC 112 ms
73,168 KB
testcase_03 AC 113 ms
72,820 KB
testcase_04 AC 113 ms
73,012 KB
testcase_05 AC 115 ms
72,924 KB
testcase_06 AC 109 ms
72,876 KB
testcase_07 AC 110 ms
73,016 KB
testcase_08 AC 112 ms
73,156 KB
testcase_09 AC 111 ms
73,176 KB
testcase_10 AC 110 ms
73,224 KB
testcase_11 AC 110 ms
73,068 KB
testcase_12 AC 112 ms
73,172 KB
testcase_13 AC 112 ms
73,284 KB
testcase_14 AC 123 ms
78,284 KB
testcase_15 AC 121 ms
78,052 KB
testcase_16 AC 117 ms
77,428 KB
testcase_17 AC 121 ms
78,120 KB
testcase_18 AC 114 ms
73,196 KB
testcase_19 AC 123 ms
77,844 KB
testcase_20 AC 121 ms
78,268 KB
testcase_21 AC 111 ms
73,036 KB
testcase_22 AC 124 ms
78,280 KB
testcase_23 AC 150 ms
78,580 KB
testcase_24 AC 172 ms
78,316 KB
testcase_25 AC 503 ms
78,472 KB
testcase_26 AC 127 ms
78,152 KB
testcase_27 AC 131 ms
78,308 KB
testcase_28 AC 502 ms
78,472 KB
testcase_29 AC 135 ms
77,992 KB
testcase_30 AC 148 ms
78,660 KB
testcase_31 AC 151 ms
78,648 KB
testcase_32 AC 132 ms
78,100 KB
testcase_33 AC 505 ms
78,752 KB
testcase_34 AC 499 ms
78,572 KB
testcase_35 AC 501 ms
78,732 KB
testcase_36 AC 502 ms
78,432 KB
testcase_37 AC 502 ms
78,524 KB
testcase_38 AC 500 ms
78,460 KB
testcase_39 AC 505 ms
78,292 KB
testcase_40 AC 500 ms
78,540 KB
testcase_41 AC 500 ms
78,552 KB
testcase_42 AC 503 ms
78,532 KB
testcase_43 AC 111 ms
72,896 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
権限があれば一括ダウンロードができます

ソースコード

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(1,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