結果
| 問題 | No.545 ママの大事な二人の子供 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-05-29 12:08:19 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 617 bytes | 
| コンパイル時間 | 89 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 46,124 KB | 
| 最終ジャッジ日時 | 2024-10-14 16:41:43 | 
| 合計ジャッジ時間 | 18,484 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 22 RE * 10 | 
ソースコード
import numpy as np
INF = 1<<50
N = int(input())
satisf = [tuple(map(int,input().split())) for _ in range(N)]
if N == 1:
    print(min(satisf[0]))
    exit()
left = np.array([satisf[0][0],-satisf[0][1]])
for x,y in satisf[1:N//2]:
    left = np.concatenate([left + x,left - y])
right = np.array([satisf[N//2][0],-satisf[N//2][1]])
for x,y in satisf[N//2 + 1:]:
    right = np.concatenate([right + x,right - y])
right = np.array([-INF] + np.sort(np.unique(right)) + [INF])
idx = np.searchsorted(right,-left,'left')
ans1 = np.abs(left + right[idx]).min()
ans2 = np.abs(left + right[idx - 1]).min()
print(min(ans1,ans2))
            
            
            
        