結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー donutholedonuthole
提出日時 2021-01-22 22:36:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 990 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 87,256 KB
実行使用メモリ 77,804 KB
最終ジャッジ日時 2023-08-27 20:35:38
合計ジャッジ時間 12,292 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
71,936 KB
testcase_01 AC 88 ms
71,724 KB
testcase_02 AC 93 ms
71,676 KB
testcase_03 AC 90 ms
71,992 KB
testcase_04 AC 90 ms
71,856 KB
testcase_05 AC 91 ms
71,660 KB
testcase_06 AC 89 ms
71,936 KB
testcase_07 AC 88 ms
71,600 KB
testcase_08 AC 89 ms
71,624 KB
testcase_09 AC 90 ms
71,976 KB
testcase_10 AC 90 ms
71,924 KB
testcase_11 AC 89 ms
71,664 KB
testcase_12 AC 89 ms
71,408 KB
testcase_13 AC 90 ms
71,444 KB
testcase_14 AC 96 ms
77,484 KB
testcase_15 AC 98 ms
77,292 KB
testcase_16 AC 89 ms
71,748 KB
testcase_17 AC 99 ms
77,300 KB
testcase_18 AC 90 ms
71,552 KB
testcase_19 AC 99 ms
77,496 KB
testcase_20 AC 100 ms
77,444 KB
testcase_21 AC 90 ms
71,624 KB
testcase_22 AC 100 ms
77,460 KB
testcase_23 AC 114 ms
77,624 KB
testcase_24 AC 138 ms
77,700 KB
testcase_25 AC 238 ms
77,528 KB
testcase_26 AC 104 ms
77,208 KB
testcase_27 AC 103 ms
77,460 KB
testcase_28 AC 240 ms
77,456 KB
testcase_29 AC 106 ms
77,804 KB
testcase_30 AC 114 ms
77,640 KB
testcase_31 AC 116 ms
77,604 KB
testcase_32 AC 107 ms
77,324 KB
testcase_33 AC 246 ms
77,400 KB
testcase_34 AC 239 ms
77,532 KB
testcase_35 AC 240 ms
77,536 KB
testcase_36 AC 242 ms
77,352 KB
testcase_37 AC 239 ms
77,200 KB
testcase_38 AC 238 ms
77,476 KB
testcase_39 AC 241 ms
77,516 KB
testcase_40 AC 241 ms
77,500 KB
testcase_41 AC 243 ms
77,560 KB
testcase_42 AC 237 ms
77,616 KB
testcase_43 AC 88 ms
71,852 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
import collections


# sys.setrecursionlimit(10000001)
INF = 10 ** 20
# MOD = 10 ** 9 + 7
MOD = 998244353


def ni(): return int(sys.stdin.buffer.readline())
def ns(): return map(int, sys.stdin.buffer.readline().split())
def na(): return list(map(int, sys.stdin.buffer.readline().split()))
def na1(): return list(map(lambda x: int(x)-1, sys.stdin.buffer.readline().split()))


# ===CODE===
def main():
    n = ni()
    a = na()
    b = [na() for _ in range(n)]

    lim = pow(2, n)
    ans = -INF
    ansc = []
    for i in range(lim):
        v = i
        res = 0
        used = []
        for j in range(n):
            if v >> j & 1:
                res += a[j]
                for ui in used:
                    res += b[j][ui]
                used.append(j)
        if ans < res:
            ans = max(ans, res)
            ansc = used
    for i in range(len(ansc)):
        ansc[i] += 1
    print(ans)
    print(*ansc)


if __name__ == '__main__':
    main()
0