結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー U SU S
提出日時 2021-01-22 21:31:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 820 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 86,860 KB
実行使用メモリ 78,612 KB
最終ジャッジ日時 2023-08-27 17:39:07
合計ジャッジ時間 14,690 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
72,956 KB
testcase_01 AC 102 ms
72,904 KB
testcase_02 AC 101 ms
73,092 KB
testcase_03 AC 107 ms
72,888 KB
testcase_04 AC 104 ms
73,000 KB
testcase_05 AC 104 ms
72,852 KB
testcase_06 AC 104 ms
72,748 KB
testcase_07 AC 105 ms
72,808 KB
testcase_08 AC 104 ms
72,964 KB
testcase_09 AC 106 ms
72,956 KB
testcase_10 AC 104 ms
72,884 KB
testcase_11 AC 105 ms
73,056 KB
testcase_12 AC 103 ms
72,752 KB
testcase_13 AC 104 ms
73,052 KB
testcase_14 AC 111 ms
78,084 KB
testcase_15 AC 112 ms
78,008 KB
testcase_16 AC 105 ms
77,852 KB
testcase_17 AC 115 ms
77,840 KB
testcase_18 AC 102 ms
73,184 KB
testcase_19 AC 116 ms
77,908 KB
testcase_20 AC 112 ms
78,116 KB
testcase_21 AC 103 ms
73,068 KB
testcase_22 AC 115 ms
78,144 KB
testcase_23 AC 145 ms
78,496 KB
testcase_24 AC 171 ms
78,236 KB
testcase_25 AC 372 ms
78,384 KB
testcase_26 AC 118 ms
77,900 KB
testcase_27 AC 116 ms
77,948 KB
testcase_28 AC 361 ms
78,496 KB
testcase_29 AC 127 ms
78,128 KB
testcase_30 AC 141 ms
78,612 KB
testcase_31 AC 137 ms
78,400 KB
testcase_32 AC 123 ms
77,916 KB
testcase_33 AC 368 ms
78,480 KB
testcase_34 AC 361 ms
78,396 KB
testcase_35 AC 369 ms
78,476 KB
testcase_36 AC 369 ms
78,380 KB
testcase_37 AC 364 ms
78,252 KB
testcase_38 AC 369 ms
78,280 KB
testcase_39 AC 366 ms
78,296 KB
testcase_40 AC 361 ms
78,432 KB
testcase_41 AC 364 ms
78,444 KB
testcase_42 AC 363 ms
78,340 KB
testcase_43 AC 102 ms
72,652 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, 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