結果
問題 |
No.1360 [Zelkova 4th Tune] 協和音
|
ユーザー |
|
提出日時 | 2021-01-23 02:58:23 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 637 bytes |
コンパイル時間 | 231 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-12-29 12:39:16 |
合計ジャッジ時間 | 5,363 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 WA * 35 |
ソースコード
from sys import stdin def main(): input = lambda: stdin.readline()[:-1] N = int(input()) A = [int(s) for s in input().split()] B = [tuple(map(int, input().split())) for _ in [0] * N] snd, score = set(), 0 for i in range(N): for j in range(i + 1, N): p = A[i] + A[j] + B[i][j] if p > 0: score += B[i][j] snd.add(i + 1) snd.add(j + 1) maxa = max(A) maxp = sum(A[i - 1] for i in snd) + score if maxp > maxa: print(maxp) print(*snd) else: print(maxa) print(A.index(maxa) + 1) main()