結果
問題 |
No.519 アイドルユニット
|
ユーザー |
![]() |
提出日時 | 2017-07-21 16:34:57 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 661 bytes |
コンパイル時間 | 173 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-10-09 03:34:04 |
合計ジャッジ時間 | 2,497 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 31 |
ソースコード
N=int(input()) dict={} li=[] for i in range(N-1): li=input().split() for j in range(N-i-1): dict[(i,N-j-1)]=int(li[N-j-1]) else: li=input() mydict=sorted(dict.items(),key=lambda x: x[1],reverse=True) myN=len(mydict) ans=0 for k in range(myN//2): x_set=set() y_set=set() x_set.add(mydict[k][0][0]) y_set.add(mydict[k][0][0]) sum=mydict[k][1] cnt=1 sum_cnt=1 while sum_cnt<(N/2): if not(mydict[k+cnt][0][0] in x_set or mydict[k+cnt][0][1] in y_set): sum+=mydict[k+cnt][1] sum_cnt+=1 cnt+=1 else: cnt+=1 if sum > ans: ans=sum print(ans)