Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B'There are n points on a coordinate axis OX . The i -th point is located at the integer point x_i and has a speed v_i . It is guaranteed that no two points occupy the same coordinate. All n points move with the constant speed, the coordinate of the i -th point at the moment t ( t can be non-integer) is calculated as x_i + t cdot v_i . Consider two points i and j . Let d(i, j) be the minimum possible distance between these two points over any possible moments of time (even non-integer). It means that if two points i and j coincide at some moment, the value d(i, j) will be 0 . Your task is to calculate the value sum limits_{1 <= i < j <= n} d(i, j) (the sum of minimum distances over all pairs of points). The first line of the input contains one integer n ( 2 <= n <= 2 cdot 10^5 ) -- the number of points. The second line of the input contains n integers x_1, x_2, ... , x_n ( 1 <= x_i <= 10^8 ), where x_i is the initial coordinate of the i -th point. It is guaranteed that all x_i are distinct. The third line of the input contains n integers v_1, v_2, ... , v_n ( -10^8 <= v_i <= 10^8 ), where v_i is the speed of the i -th point. Print one integer -- the value sum limits_{1 <= i < j <= n} d(i, j) (the sum of minimum distances over all pairs of points). '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
71922293 |
561561561 |
F |
Feb. 26, 2020, 3:09 p.m. |
OK |
GNU C11 |
TESTS |
26 |
186 |
5632000 |
|
2100 |
71827334 |
TYGL |
F |
Feb. 24, 2020, 11:42 p.m. |
OK |
GNU C++11 |
TESTS |
26 |
78 |
3174400 |
|
2100 |
71888787 |
TYGZ |
F |
Feb. 26, 2020, 12:20 a.m. |
OK |
GNU C++11 |
TESTS |
26 |
78 |
3174400 |
|
2100 |
71786097 |
zhumingyang |
F |
Feb. 24, 2020, 3:10 p.m. |
OK |
GNU C++11 |
TESTS |
26 |
93 |
3993600 |
|
2100 |
71909757 |
_Backl1ght |
F |
Feb. 26, 2020, 11:20 a.m. |
OK |
GNU C++11 |
TESTS |
26 |
93 |
5120000 |
|
2100 |
71833271 |
cjtsear |
F |
Feb. 25, 2020, 4:13 a.m. |
OK |
GNU C++11 |
TESTS |
26 |
93 |
5427200 |
|
2100 |
71832905 |
clfzs |
F |
Feb. 25, 2020, 3:58 a.m. |
OK |
GNU C++11 |
TESTS |
26 |
93 |
5632000 |
|
2100 |
71840171 |
Frame233 |
F |
Feb. 25, 2020, 7:07 a.m. |
OK |
GNU C++11 |
TESTS |
26 |
93 |
5632000 |
|
2100 |
71804100 |
_zay |
F |
Feb. 24, 2020, 4:13 p.m. |
OK |
GNU C++11 |
TESTS |
26 |
93 |
6451200 |
|
2100 |
71795315 |
z7z_Eta |
F |
Feb. 24, 2020, 3:38 p.m. |
OK |
GNU C++11 |
TESTS |
26 |
93 |
8601600 |
|
2100 |
71909753 |
ctjcalc |
F |
Feb. 26, 2020, 11:20 a.m. |
OK |
GNU C++11 |
TESTS |
26 |
108 |
5632000 |
|
2100 |
71860573 |
TouchMe |
F |
Feb. 25, 2020, 1:29 p.m. |
OK |
GNU C++14 |
TESTS |
26 |
155 |
17612800 |
|
2100 |
71824980 |
TouchMe |
F |
Feb. 24, 2020, 9:50 p.m. |
OK |
GNU C++14 |
TESTS |
26 |
156 |
17612800 |
|
2100 |
71835427 |
willingox |
F |
Feb. 25, 2020, 5:17 a.m. |
OK |
GNU C++14 |
TESTS |
26 |
171 |
4812800 |
|
2100 |
71840611 |
Zery_test |
F |
Feb. 25, 2020, 7:17 a.m. |
OK |
GNU C++14 |
TESTS |
26 |
171 |
5632000 |
|
2100 |
71832637 |
Neuni |
F |
Feb. 25, 2020, 3:49 a.m. |
OK |
GNU C++14 |
TESTS |
26 |
171 |
5632000 |
|
2100 |
71952954 |
vjudge3 |
F |
Feb. 27, 2020, 5:57 a.m. |
OK |
GNU C++14 |
TESTS |
26 |
171 |
5632000 |
|
2100 |
71868843 |
YuMing_mov |
F |
Feb. 25, 2020, 3:36 p.m. |
OK |
GNU C++14 |
TESTS |
26 |
171 |
5939200 |
|
2100 |
71800108 |
shdut0901 |
F |
Feb. 24, 2020, 3:57 p.m. |
OK |
GNU C++14 |
TESTS |
26 |
171 |
6451200 |
|
2100 |
71940318 |
sam721 |
F |
Feb. 26, 2020, 9:25 p.m. |
OK |
GNU C++14 |
TESTS |
26 |
186 |
4812800 |
|
2100 |
71844402 |
ZzQf |
F |
Feb. 25, 2020, 8:40 a.m. |
OK |
GNU C++14 |
TESTS |
26 |
186 |
7270400 |
|
2100 |
71913825 |
JeremyMo |
F |
Feb. 26, 2020, 12:39 p.m. |
OK |
GNU C++17 |
TESTS |
26 |
155 |
7168000 |
|
2100 |
71834990 |
xuyifeng |
F |
Feb. 25, 2020, 5:06 a.m. |
OK |
GNU C++17 |
TESTS |
26 |
156 |
3174400 |
|
2100 |
71859418 |
Ethylene |
F |
Feb. 25, 2020, 1:12 p.m. |
OK |
GNU C++17 |
TESTS |
26 |
156 |
7270400 |
|
2100 |
71935142 |
Kenzo1114 |
F |
Feb. 26, 2020, 7:09 p.m. |
OK |
GNU C++17 |
TESTS |
26 |
156 |
8806400 |
|
2100 |
71956020 |
Do_Re_Mi |
F |
Feb. 27, 2020, 7:08 a.m. |
OK |
GNU C++17 |
TESTS |
26 |
171 |
2457600 |
|
2100 |
71905231 |
G_bg |
F |
Feb. 26, 2020, 9:42 a.m. |
OK |
GNU C++17 |
TESTS |
26 |
171 |
2457600 |
|
2100 |
71957661 |
vjudge1 |
F |
Feb. 27, 2020, 7:48 a.m. |
OK |
GNU C++17 |
TESTS |
26 |
171 |
2457600 |
|
2100 |
71843084 |
X-knight |
F |
Feb. 25, 2020, 8:11 a.m. |
OK |
GNU C++17 |
TESTS |
26 |
171 |
5632000 |
|
2100 |
71838467 |
ShakuganNoShana |
F |
Feb. 25, 2020, 6:33 a.m. |
OK |
GNU C++17 |
TESTS |
26 |
171 |
5632000 |
|
2100 |
71832221 |
Conan73 |
F |
Feb. 25, 2020, 3:35 a.m. |
OK |
GNU C++17 |
TESTS |
26 |
171 |
5632000 |
|
2100 |
71787218 |
uwi |
F |
Feb. 24, 2020, 3:13 p.m. |
OK |
Java 11 |
TESTS |
26 |
343 |
4403200 |
|
2100 |
71902945 |
Azakarka |
F |
Feb. 26, 2020, 8:45 a.m. |
OK |
Java 11 |
TESTS |
26 |
592 |
18944000 |
|
2100 |
71830054 |
bleh0.5 |
F |
Feb. 25, 2020, 2:10 a.m. |
OK |
Java 11 |
TESTS |
26 |
686 |
29184000 |
|
2100 |
71811099 |
TheSawan |
F |
Feb. 24, 2020, 4:49 p.m. |
OK |
Java 11 |
TESTS |
26 |
701 |
28672000 |
|
2100 |
71855856 |
ZeyadKhattab |
F |
Feb. 25, 2020, 12:15 p.m. |
OK |
Java 11 |
TESTS |
26 |
858 |
33484800 |
|
2100 |
71952946 |
acesine |
F |
Feb. 27, 2020, 5:57 a.m. |
OK |
Java 11 |
TESTS |
26 |
1091 |
25190400 |
|
2100 |
71813644 |
jst_forfun |
F |
Feb. 24, 2020, 5:20 p.m. |
OK |
Java 11 |
TESTS |
26 |
1107 |
39116800 |
|
2100 |
71787954 |
Dukkha |
F |
Feb. 24, 2020, 3:15 p.m. |
OK |
Java 11 |
TESTS |
26 |
1122 |
6860800 |
|
2100 |
71935486 |
In_The_Name_Of_Love |
F |
Feb. 26, 2020, 7:16 p.m. |
OK |
Java 8 |
TESTS |
26 |
280 |
2252800 |
|
2100 |
71825111 |
icpc_loser |
F |
Feb. 24, 2020, 9:54 p.m. |
OK |
Java 8 |
TESTS |
26 |
389 |
13414400 |
|
2100 |
71792232 |
aman28rwt |
F |
Feb. 24, 2020, 3:28 p.m. |
OK |
Java 8 |
TESTS |
26 |
436 |
14643200 |
|
2100 |
71842431 |
xwchen |
F |
Feb. 25, 2020, 7:56 a.m. |
OK |
Java 8 |
TESTS |
26 |
451 |
15769600 |
|
2100 |
71868483 |
sguar |
F |
Feb. 25, 2020, 3:30 p.m. |
OK |
Java 8 |
TESTS |
26 |
514 |
35635200 |
|
2100 |
71875498 |
htvu |
F |
Feb. 25, 2020, 5:36 p.m. |
OK |
Java 8 |
TESTS |
26 |
561 |
35225600 |
|
2100 |
71875322 |
htvu |
F |
Feb. 25, 2020, 5:32 p.m. |
OK |
Java 8 |
TESTS |
26 |
576 |
35225600 |
|
2100 |
71875769 |
htvu |
F |
Feb. 25, 2020, 5:42 p.m. |
OK |
Java 8 |
TESTS |
26 |
577 |
35225600 |
|
2100 |
71949062 |
Sharon |
F |
Feb. 27, 2020, 3:56 a.m. |
OK |
Java 8 |
TESTS |
26 |
577 |
37990400 |
|
2100 |
71876171 |
aakash0711 |
F |
Feb. 25, 2020, 5:50 p.m. |
OK |
Java 8 |
TESTS |
26 |
607 |
35225600 |
|
2100 |
71918593 |
yakamoto |
F |
Feb. 26, 2020, 2:03 p.m. |
OK |
Kotlin |
TESTS |
26 |
577 |
22323200 |
|
2100 |
71948952 |
Benq |
F |
Feb. 27, 2020, 3:52 a.m. |
OK |
Kotlin |
TESTS |
26 |
764 |
33484800 |
|
2100 |
71814349 |
avm |
F |
Feb. 24, 2020, 5:30 p.m. |
OK |
Kotlin |
TESTS |
26 |
1076 |
32153600 |
|
2100 |
71815912 |
Tlatoani |
F |
Feb. 24, 2020, 5:54 p.m. |
OK |
Kotlin |
TESTS |
26 |
1964 |
189952000 |
|
2100 |
71818882 |
r57shell |
F |
Feb. 24, 2020, 6:51 p.m. |
OK |
MS C++ |
TESTS |
26 |
171 |
12800000 |
|
2100 |
71801161 |
danilgrig |
F |
Feb. 24, 2020, 4:01 p.m. |
OK |
MS C++ |
TESTS |
26 |
420 |
5632000 |
|
2100 |
71797159 |
pichulia |
F |
Feb. 24, 2020, 3:45 p.m. |
OK |
MS C++ 2017 |
TESTS |
26 |
327 |
13209600 |
|
2100 |
71803777 |
youx |
F |
Feb. 24, 2020, 4:12 p.m. |
OK |
MS C++ 2017 |
TESTS |
26 |
374 |
22323200 |
|
2100 |
71830289 |
nonstopfor |
F |
Feb. 25, 2020, 2:20 a.m. |
OK |
MS C++ 2017 |
TESTS |
26 |
436 |
6758400 |
|
2100 |
71902992 |
MinhNguye |
F |
Feb. 26, 2020, 8:46 a.m. |
OK |
MS C++ 2017 |
TESTS |
26 |
514 |
29798400 |
|
2100 |
71809111 |
CrashMaster |
F |
Feb. 24, 2020, 4:33 p.m. |
OK |
MS C++ 2017 |
TESTS |
26 |
639 |
12083200 |
|
2100 |
71819190 |
extremum |
F |
Feb. 24, 2020, 6:57 p.m. |
OK |
MS C++ 2017 |
TESTS |
26 |
841 |
14745600 |
|
2100 |
71808211 |
pajenegod |
F |
Feb. 24, 2020, 4:30 p.m. |
OK |
PyPy 2 |
TESTS |
26 |
1403 |
34508800 |
|
2100 |
71868972 |
cho12 |
F |
Feb. 25, 2020, 3:39 p.m. |
OK |
PyPy 3 |
TESTS |
26 |
1325 |
35430400 |
|
2100 |
71841990 |
ltf0501 |
F |
Feb. 25, 2020, 7:47 a.m. |
OK |
PyPy 3 |
TESTS |
26 |
1435 |
34201600 |
|
2100 |
71850655 |
pye |
F |
Feb. 25, 2020, 10:47 a.m. |
OK |
PyPy 3 |
TESTS |
26 |
1466 |
28876800 |
|
2100 |
71848125 |
addammy |
F |
Feb. 25, 2020, 9:56 a.m. |
OK |
PyPy 3 |
TESTS |
26 |
1559 |
37580800 |
|
2100 |
71895527 |
satyamcse |
F |
Feb. 26, 2020, 5:12 a.m. |
OK |
PyPy 3 |
TESTS |
26 |
1574 |
61542400 |
|
2100 |
71857798 |
RedLeaf |
F |
Feb. 25, 2020, 12:47 p.m. |
OK |
PyPy 3 |
TESTS |
26 |
1575 |
27852800 |
|
2100 |
71869244 |
cho12 |
F |
Feb. 25, 2020, 3:44 p.m. |
OK |
PyPy 3 |
TESTS |
26 |
1606 |
30822400 |
|
2100 |
71867745 |
cho12 |
F |
Feb. 25, 2020, 3:18 p.m. |
OK |
PyPy 3 |
TESTS |
26 |
1653 |
30617600 |
|
2100 |
71804780 |
Soapen |
F |
Feb. 24, 2020, 4:16 p.m. |
OK |
PyPy 3 |
TESTS |
26 |
1653 |
36044800 |
|
2100 |
71864639 |
mkawa2 |
F |
Feb. 25, 2020, 2:30 p.m. |
OK |
PyPy 3 |
TESTS |
26 |
1653 |
39936000 |
|
2100 |
71848387 |
manta1130 |
F |
Feb. 25, 2020, 10:01 a.m. |
OK |
Rust |
TESTS |
26 |
124 |
10854400 |
|
2100 |
71831686 |
clearlycloudy |
F |
Feb. 25, 2020, 3:14 a.m. |
OK |
Rust |
TESTS |
26 |
171 |
18022400 |
|
2100 |
71829999 |
sansen |
F |
Feb. 25, 2020, 2:08 a.m. |
OK |
Rust |
TESTS |
26 |
202 |
22118400 |
|
2100 |
71824587 |
mversic101 |
F |
Feb. 24, 2020, 9:35 p.m. |
OK |
Rust |
TESTS |
26 |
249 |
19353600 |
|
2100 |
71794873 |
sansen |
F |
Feb. 24, 2020, 3:37 p.m. |
OK |
Rust |
TESTS |
26 |
265 |
26316800 |
|
2100 |
71804735 |
akiradeveloper |
F |
Feb. 24, 2020, 4:16 p.m. |
OK |
Rust |
TESTS |
26 |
701 |
19865600 |
|
2100 |
remove filters
Back to search problems