結果
問題 |
No.1251 絶対に間違ってはいけない最小化問題
|
ユーザー |
![]() |
提出日時 | 2021-01-23 18:53:02 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 622 bytes |
コンパイル時間 | 169 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 45,060 KB |
最終ジャッジ日時 | 2024-12-31 10:19:10 |
合計ジャッジ時間 | 30,012 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 2 WA * 40 |
ソースコード
import sys def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline().rstrip().split()) n = I() a = LI() b = LI() L = [] sb = sum(b) for i in range(n): L.append([a[i], b[i]]) L.sort() tmp = 0 ans = n for i in range(n): tmp += b[i] if tmp >= (sb+1)//2: ans = i break fx = 0 for i in range(n): fx += b[i]*abs(a[i]-a[ans]) print(a[ans], fx)