The primary line contains a solitary integer n (1≤n≤150000). The subsequent line contains 2n integers a1,a2,… ,a2n (1≤ai≤109) — components of exhibit a. Output Print one integer — the response to the issue, modulo 998244353.
Correct answer will be upvoted else Multiple Downvoted. Don't submit random answer. Computer science.
You are given a cluster an of length 2n. Consider a segment of exhibit an into two aftereffects p and q of length n each (every component of cluster an ought to be in precisely one aftereffect: either in p or in q).
We should sort p in non-diminishing request, and q in non-expanding request, we can indicate the arranged adaptations by x and y, individually. Then, at that point, the expense of a segment is characterized as f(p,q)=∑ni=1|xi−yi|.
Track down the amount of f(p,q) over all right parcels of cluster a. Since the appropriate response may be too huge, print its remaining portion modulo 998244353.
Input
The primary line contains a solitary integer n (1≤n≤150000).
The subsequent line contains 2n integers a1,a2,… ,a2n (1≤
Output
Print one integer — the response to the issue, modulo 998244353.
Step by step
Solved in 3 steps with 1 images