結果
問題 | No.1360 [Zelkova 4th Tune] 協和音 |
ユーザー |
|
提出日時 | 2021-01-22 21:41:11 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 872 ms / 2,000 ms |
コード長 | 474 bytes |
コンパイル時間 | 277 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 76,288 KB |
最終ジャッジ日時 | 2024-12-27 22:57:37 |
合計ジャッジ時間 | 18,547 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 47 |
ソースコード
import itertoolsN = int(input())A = tuple(map(int, input().split()))B = [tuple(map(int, input().split())) for _ in range(N)]w = -float('inf')it = itertools.product((0, 1), repeat=N)next(it)for t in it:tmp = 0comp = list(itertools.compress(range(N), t))for x in comp:tmp += A[x]for x, y in itertools.combinations(comp, 2):tmp += B[x][y]if w < tmp:J = tuple(x + 1 for x in comp)w = tmpprint(w)print(*J)