結果
問題 | No.1360 [Zelkova 4th Tune] 協和音 |
ユーザー |
![]() |
提出日時 | 2021-01-22 21:30:36 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 539 bytes |
コンパイル時間 | 1,198 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 76,416 KB |
最終ジャッジ日時 | 2024-12-27 21:41:12 |
合計ジャッジ時間 | 12,975 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 41 |
ソースコード
n = int(input()) a = list(map(int, input().split())) b = [list(map(int, input().split())) for i in range(n)] ans = 0 bit = 0 for bit_state in range(1 << n): score = 0 for i in range(n): if (bit_state >> i) & 1: score += a[i] for j in range(n): if (bit_state >> j) & 1: score += b[i][j] if score >= ans: ans = max(ans, score) bit = bit_state res = [] for i in range(n): if (bit >> i) & 1: res.append(i + 1) print(ans) print(*res)