{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"问题描述","value":{"format":"MD","content":"一根无限长木棍可以看做一个数轴,上面有$n$只蚂蚁(蚂蚁的位置互不相同),蚂蚁的编号分别为$1,2,3...n$。从时间$t\u003d0s$开始,所有的蚂蚁同时开始运动,第$i$号蚂蚁初始坐标为$x_i$,全程以$v_i$的速度移动($v_i\u003e0$表示朝正方向移动,$v_i\u003c0$表示朝负方向以$|v_i|$移动,$v_i\u003d0$表示静止)。\n定义$\\text{dist}(i,j)(1\\leq i\u003cj\\leq n)$表示从时间$t\u003d0s$开始直到$t\u003d114514^{1919810}s$的时间段内(闭区间),$i$号蚂蚁与$j$号蚂蚁之间$\\bold{\\underline{距离}}$的最小值(时间$t$不一定是整数,而是连续均匀变化的实数)。特别的,如果两只蚂蚁在某一时刻能够相遇,则他们的$\\text{dist}(i,j)\u003d0$。\n求$\\sum_{1\\leq i\u003cj\\leq n}\\text{dist}(i,j)$\n即每一对蚂蚁之间的$\\text{dist}(i,j)$之和"}},{"title":"输入描述","value":{"format":"MD","content":"输入第一行有一个正整数$n(2\\leq n\\leq 2\\cdot 10^5)$\n第二行是$n$个整数$x_1,x_2...x_n$表示每只蚂蚁的初始坐标,输入保证$n$个坐标互不相同$(1\\leq x_i\\leq10^8)$\n第三行是$n$个整数$v_1,v_2...v_n$表示每只蚂蚁的运动速度$(-10^8\\leq v_i\\leq10^8)$"}},{"title":"输出描述","value":{"format":"MD","content":"输出一个整数$ans$代表每一对蚂蚁之间的$\\text{dist}(i,j)$之和。可以证明在本题的限制条件下最终的答案一定是个整数。"}},{"title":"样例1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\n10 30 20\n1 1 4\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e30\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"样例2","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\n200 100 400 300 500\n7 7 7 30 50\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1900\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"样例3","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\n23 22 21 20 19\n-2 3 5 7 11\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}