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"Jeff's friends know full well that the boy likes to get sequences and arrays for his birthday. Thus, Jeff got sequence p1, xe2 x80 x89p2, xe2 x80 x89..., xe2 x80 x89pn for his birthday. Jeff hates inversions in sequences. An inversion in sequence a1, xe2 x80 x89a2, xe2 x80 x89..., xe2 x80 x89an is a pair of indexes i, xe2 x80 x89j (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89i xe2 x80 x89< xe2 x80 x89j xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n), such that an inequality ai xe2 x80 x89> xe2 x80 x89aj holds. Jeff can multiply some numbers of the sequence p by -1. At that, he wants the number of inversions in the sequence to be minimum. Help Jeff and find the minimum number of inversions he manages to get. The first line contains integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x892000). The next line contains n integers -- sequence p1, p2, ..., pn (|pi| xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105). The numbers are separated by spaces. In a single line print the answer to the problem -- the minimum number of inversions Jeff can get."... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
4746582 |
Nik_Storm_2010 |
E |
Oct. 11, 2013, 4:30 p.m. |
OK |
FPC |
TESTS |
36 |
30 |
0 |
|
2200 |
4720669 |
gamezovladislav |
E |
Oct. 9, 2013, 8:22 p.m. |
OK |
FPC |
TESTS |
36 |
62 |
0 |
|
2200 |
5122408 |
zhzq123 |
E |
Nov. 16, 2013, 1:44 a.m. |
OK |
FPC |
TESTS |
36 |
62 |
0 |
|
2200 |
4665888 |
orzkac |
E |
Oct. 4, 2013, 4:27 p.m. |
OK |
FPC |
TESTS |
36 |
62 |
0 |
|
2200 |
4668648 |
SanSiroWaltz |
E |
Oct. 4, 2013, 4:54 p.m. |
OK |
FPC |
TESTS |
36 |
92 |
0 |
|
2200 |
5652783 |
Wolfik |
E |
Jan. 10, 2014, 12:43 p.m. |
OK |
FPC |
TESTS |
36 |
92 |
0 |
|
2200 |
4717201 |
Astreb |
E |
Oct. 9, 2013, 2:01 p.m. |
OK |
FPC |
TESTS |
36 |
92 |
0 |
|
2200 |
4994004 |
YePro12 |
E |
Nov. 5, 2013, 2:18 p.m. |
OK |
FPC |
TESTS |
36 |
92 |
19456000 |
|
2200 |
4668368 |
Um_nik |
E |
Oct. 4, 2013, 4:51 p.m. |
OK |
FPC |
TESTS |
36 |
1404 |
0 |
|
2200 |
4711013 |
vivekrai_008 |
E |
Oct. 8, 2013, 6:40 p.m. |
OK |
GNU C |
TESTS |
36 |
30 |
0 |
|
2200 |
4913800 |
Quexint |
E |
Oct. 27, 2013, 2:53 p.m. |
OK |
GNU C++ |
TESTS |
36 |
15 |
0 |
|
2200 |
4909896 |
fqw |
E |
Oct. 27, 2013, 7:40 a.m. |
OK |
GNU C++ |
TESTS |
36 |
15 |
0 |
|
2200 |
4930664 |
burakbugrul |
E |
Oct. 29, 2013, 7:01 p.m. |
OK |
GNU C++ |
TESTS |
36 |
15 |
409600 |
|
2200 |
30244905 |
lllllllllllllllllllllll |
E |
Sept. 10, 2017, 12:25 p.m. |
OK |
GNU C++ |
TESTS |
36 |
30 |
0 |
|
2200 |
27448669 |
vjudge2 |
E |
May 30, 2017, 1:06 p.m. |
OK |
GNU C++ |
TESTS |
36 |
30 |
0 |
|
2200 |
27413089 |
vjudge2 |
E |
May 28, 2017, 12:41 p.m. |
OK |
GNU C++ |
TESTS |
36 |
30 |
0 |
|
2200 |
27400620 |
Baigker |
E |
May 28, 2017, 4:26 a.m. |
OK |
GNU C++ |
TESTS |
36 |
30 |
0 |
|
2200 |
21864043 |
vjudge1 |
E |
Oct. 29, 2016, 5:24 a.m. |
OK |
GNU C++ |
TESTS |
36 |
30 |
0 |
|
2200 |
19003780 |
abcdef6199 |
E |
July 10, 2016, 9:47 a.m. |
OK |
GNU C++ |
TESTS |
36 |
30 |
0 |
|
2200 |
14419839 |
Bugday |
E |
Nov. 22, 2015, 10:06 p.m. |
OK |
GNU C++ |
TESTS |
36 |
30 |
0 |
|
2200 |
10219137 |
SeyedParsa |
E |
March 9, 2015, 3:44 p.m. |
OK |
GNU C++0x |
TESTS |
36 |
30 |
0 |
|
2200 |
9880409 |
VishalTheBEAST |
E |
Feb. 17, 2015, 9:58 a.m. |
OK |
GNU C++0x |
TESTS |
36 |
30 |
0 |
|
2200 |
8795908 |
hogloid |
E |
Nov. 22, 2014, 5:46 a.m. |
OK |
GNU C++0x |
TESTS |
36 |
30 |
0 |
|
2200 |
7357477 |
delta_4d |
E |
Aug. 6, 2014, 4:53 a.m. |
OK |
GNU C++0x |
TESTS |
36 |
30 |
0 |
|
2200 |
5617884 |
sping128 |
E |
Jan. 4, 2014, 6:56 p.m. |
OK |
GNU C++0x |
TESTS |
36 |
30 |
0 |
|
2200 |
5481618 |
vjudge2 |
E |
Dec. 20, 2013, 3:33 p.m. |
OK |
GNU C++0x |
TESTS |
36 |
30 |
0 |
|
2200 |
5481587 |
SqrtPi |
E |
Dec. 20, 2013, 3:27 p.m. |
OK |
GNU C++0x |
TESTS |
36 |
30 |
0 |
|
2200 |
5261920 |
mruxim |
E |
Nov. 26, 2013, 8:45 p.m. |
OK |
GNU C++0x |
TESTS |
36 |
30 |
0 |
|
2200 |
4985306 |
Archon.JK |
E |
Nov. 4, 2013, 11:22 a.m. |
OK |
GNU C++0x |
TESTS |
36 |
30 |
0 |
|
2200 |
4711266 |
StefanoT |
E |
Oct. 8, 2013, 7:24 p.m. |
OK |
GNU C++0x |
TESTS |
36 |
30 |
0 |
|
2200 |
59951773 |
rainboy |
E |
Sept. 3, 2019, 2:45 p.m. |
OK |
GNU C11 |
TESTS |
36 |
62 |
0 |
|
2200 |
22691085 |
RockyB |
E |
Dec. 4, 2016, 7:47 a.m. |
OK |
GNU C++11 |
TESTS |
36 |
30 |
0 |
|
2200 |
21902298 |
Diego1149 |
E |
Oct. 31, 2016, 2:33 a.m. |
OK |
GNU C++11 |
TESTS |
36 |
30 |
0 |
|
2200 |
21818559 |
khadaev |
E |
Oct. 27, 2016, 10:30 a.m. |
OK |
GNU C++11 |
TESTS |
36 |
30 |
0 |
|
2200 |
20418867 |
xiqiao |
E |
Sept. 6, 2016, 12:35 p.m. |
OK |
GNU C++11 |
TESTS |
36 |
30 |
0 |
|
2200 |
18943862 |
adminFrost |
E |
July 7, 2016, 6:01 a.m. |
OK |
GNU C++11 |
TESTS |
36 |
30 |
0 |
|
2200 |
16685046 |
fengsuiyan |
E |
March 13, 2016, 4:55 a.m. |
OK |
GNU C++11 |
TESTS |
36 |
30 |
0 |
|
2200 |
16606628 |
Yukine_Chris |
E |
March 8, 2016, 6:34 p.m. |
OK |
GNU C++11 |
TESTS |
36 |
30 |
0 |
|
2200 |
15790676 |
SmallBoy |
E |
Feb. 4, 2016, 4:17 p.m. |
OK |
GNU C++11 |
TESTS |
36 |
30 |
0 |
|
2200 |
15342087 |
Resul |
E |
Jan. 14, 2016, 9:29 a.m. |
OK |
GNU C++11 |
TESTS |
36 |
30 |
0 |
|
2200 |
30941967 |
DTDT |
E |
Oct. 2, 2017, 12:13 p.m. |
OK |
GNU C++11 |
TESTS |
36 |
30 |
0 |
|
2200 |
31957285 |
ChickenInKitchen |
E |
Nov. 1, 2017, 4:35 p.m. |
OK |
GNU C++14 |
TESTS |
36 |
30 |
0 |
|
2200 |
30529703 |
Alpha_Q |
E |
Sept. 19, 2017, 9:26 p.m. |
OK |
GNU C++14 |
TESTS |
36 |
30 |
0 |
|
2200 |
27753510 |
haleyk100198 |
E |
June 13, 2017, 10:42 a.m. |
OK |
GNU C++14 |
TESTS |
36 |
30 |
0 |
|
2200 |
27227048 |
RNS_JKS |
E |
May 20, 2017, 3:02 a.m. |
OK |
GNU C++14 |
TESTS |
36 |
30 |
0 |
|
2200 |
27227047 |
RNS3 |
E |
May 20, 2017, 3:02 a.m. |
OK |
GNU C++14 |
TESTS |
36 |
30 |
0 |
|
2200 |
47525857 |
Rtn_e |
E |
Dec. 26, 2018, 3:49 p.m. |
OK |
GNU C++14 |
TESTS |
36 |
30 |
0 |
|
2200 |
27879975 |
cr0n |
E |
June 18, 2017, 8:22 a.m. |
OK |
GNU C++14 |
TESTS |
36 |
30 |
204800 |
|
2200 |
21217339 |
MadNick |
E |
Oct. 5, 2016, 5:13 p.m. |
OK |
GNU C++14 |
TESTS |
36 |
30 |
409600 |
|
2200 |
51575891 |
shurongwang |
E |
March 20, 2019, 12:55 p.m. |
OK |
GNU C++14 |
TESTS |
36 |
30 |
819200 |
|
2200 |
31132770 |
Lucky_Sanae |
E |
Oct. 8, 2017, 4:53 a.m. |
OK |
GNU C++14 |
TESTS |
36 |
30 |
819200 |
|
2200 |
54455437 |
vjudge5 |
E |
May 21, 2019, 3:36 p.m. |
OK |
GNU C++17 |
TESTS |
36 |
30 |
0 |
|
2200 |
58138884 |
kostia244 |
E |
Aug. 1, 2019, 5:16 p.m. |
OK |
GNU C++17 |
TESTS |
36 |
62 |
0 |
|
2200 |
67370365 |
yasharp83 |
E |
Dec. 21, 2019, 1:53 p.m. |
OK |
GNU C++17 |
TESTS |
36 |
62 |
0 |
|
2200 |
67296803 |
Hasti_K |
E |
Dec. 20, 2019, 5:13 p.m. |
OK |
GNU C++17 |
TESTS |
36 |
62 |
0 |
|
2200 |
67280899 |
rima |
E |
Dec. 20, 2019, 1:02 p.m. |
OK |
GNU C++17 |
TESTS |
36 |
62 |
0 |
|
2200 |
59536179 |
VodkaInTheJar |
E |
Aug. 26, 2019, 4:59 p.m. |
OK |
GNU C++17 |
TESTS |
36 |
62 |
0 |
|
2200 |
58689624 |
czh27348 |
E |
Aug. 13, 2019, 2:25 a.m. |
OK |
GNU C++17 |
TESTS |
36 |
62 |
0 |
|
2200 |
57783709 |
mohammad258 |
E |
July 26, 2019, 6:57 a.m. |
OK |
GNU C++17 |
TESTS |
36 |
62 |
0 |
|
2200 |
56392374 |
AliShahali1382 |
E |
July 1, 2019, 1:07 p.m. |
OK |
GNU C++17 |
TESTS |
36 |
62 |
0 |
|
2200 |
55402838 |
ruo |
E |
June 10, 2019, 2:55 p.m. |
OK |
GNU C++17 |
TESTS |
36 |
62 |
0 |
|
2200 |
4683001 |
Ljubitel |
E |
Oct. 5, 2013, 6:38 p.m. |
OK |
Java 6 |
TESTS |
36 |
156 |
0 |
|
2200 |
4677047 |
hiukim |
E |
Oct. 5, 2013, 3:42 a.m. |
OK |
Java 6 |
TESTS |
36 |
186 |
0 |
|
2200 |
7484801 |
vjudge3 |
E |
Aug. 16, 2014, 2:24 p.m. |
OK |
Java 6 |
TESTS |
36 |
218 |
0 |
|
2200 |
4702566 |
paul.miner |
E |
Oct. 7, 2013, 2:40 p.m. |
OK |
Java 6 |
TESTS |
36 |
218 |
0 |
|
2200 |
4671648 |
wackloner |
E |
Oct. 4, 2013, 5:26 p.m. |
OK |
Java 6 |
TESTS |
36 |
1590 |
0 |
|
2200 |
5807277 |
hama-du |
E |
Jan. 25, 2014, 3:47 p.m. |
OK |
Java 7 |
TESTS |
36 |
154 |
0 |
|
2200 |
4698764 |
AIdancer |
E |
Oct. 7, 2013, 3:37 a.m. |
OK |
Java 7 |
TESTS |
36 |
156 |
0 |
|
2200 |
4666279 |
ilyakor |
E |
Oct. 4, 2013, 4:31 p.m. |
OK |
Java 7 |
TESTS |
36 |
156 |
0 |
|
2200 |
9279116 |
tapan0007 |
E |
Dec. 26, 2014, 9:02 p.m. |
OK |
Java 7 |
TESTS |
36 |
184 |
0 |
|
2200 |
11137920 |
peter31415 |
E |
May 18, 2015, 6:05 p.m. |
OK |
Java 7 |
TESTS |
36 |
186 |
0 |
|
2200 |
4678854 |
hyggyh |
E |
Oct. 5, 2013, 8:26 a.m. |
OK |
Java 7 |
TESTS |
36 |
186 |
0 |
|
2200 |
4672052 |
Vbifial |
E |
Oct. 4, 2013, 5:29 p.m. |
OK |
Java 7 |
TESTS |
36 |
186 |
0 |
|
2200 |
4668921 |
pashkal |
E |
Oct. 4, 2013, 4:57 p.m. |
OK |
Java 7 |
TESTS |
36 |
186 |
0 |
|
2200 |
4666710 |
chavit |
E |
Oct. 4, 2013, 4:35 p.m. |
OK |
Java 7 |
TESTS |
36 |
186 |
0 |
|
2200 |
4660464 |
Egor |
E |
Oct. 4, 2013, 3:49 p.m. |
OK |
Java 7 |
TESTS |
36 |
186 |
102400 |
|
2200 |
12873736 |
fiter |
E |
Sept. 6, 2015, 2:34 p.m. |
OK |
Java 8 |
TESTS |
36 |
248 |
0 |
|
2200 |
11128681 |
AlexFetisov |
E |
May 17, 2015, 5:16 p.m. |
OK |
Java 8 |
TESTS |
36 |
248 |
0 |
|
2200 |
58882645 |
beginner1010 |
E |
Aug. 15, 2019, 10:37 p.m. |
OK |
Java 8 |
TESTS |
36 |
280 |
0 |
|
2200 |
38307371 |
flyman3046 |
E |
May 16, 2018, 3:28 a.m. |
OK |
Java 8 |
TESTS |
36 |
280 |
20684800 |
|
2200 |
21198351 |
miguelmaurizio |
E |
Oct. 4, 2016, 11:58 p.m. |
OK |
Java 8 |
TESTS |
36 |
310 |
0 |
|
2200 |
21150735 |
Sumeet.Varma |
E |
Oct. 3, 2016, 12:46 p.m. |
OK |
Java 8 |
TESTS |
36 |
310 |
0 |
|
2200 |
11382597 |
AStepanov |
E |
June 1, 2015, 7:03 p.m. |
OK |
Java 8 |
TESTS |
36 |
340 |
0 |
|
2200 |
50775968 |
hongquanntct |
E |
March 4, 2019, 8:31 a.m. |
OK |
Java 8 |
TESTS |
36 |
342 |
0 |
|
2200 |
9874633 |
qwerty787788 |
E |
Feb. 16, 2015, 6:26 p.m. |
OK |
Java 8 |
TESTS |
36 |
342 |
0 |
|
2200 |
59951772 |
Dukkha |
E |
Sept. 3, 2019, 2:45 p.m. |
OK |
Java 8 |
TESTS |
36 |
374 |
0 |
|
2200 |
5807772 |
EmK |
E |
Jan. 25, 2014, 5:04 p.m. |
OK |
MS C# |
TESTS |
36 |
156 |
2560000 |
|
2200 |
5808231 |
EmK |
E |
Jan. 25, 2014, 6:11 p.m. |
OK |
MS C# |
TESTS |
36 |
156 |
2662400 |
|
2200 |
4720234 |
LightRay |
E |
Oct. 9, 2013, 6:51 p.m. |
OK |
MS C++ |
TESTS |
36 |
30 |
0 |
|
2200 |
4718909 |
usingtc |
E |
Oct. 9, 2013, 4:17 p.m. |
OK |
MS C++ |
TESTS |
36 |
30 |
0 |
|
2200 |
4706797 |
tomas.svab |
E |
Oct. 8, 2013, 7:42 a.m. |
OK |
MS C++ |
TESTS |
36 |
30 |
0 |
|
2200 |
4677675 |
uncleFun |
E |
Oct. 5, 2013, 5:57 a.m. |
OK |
MS C++ |
TESTS |
36 |
30 |
0 |
|
2200 |
4673697 |
kriii |
E |
Oct. 4, 2013, 6:25 p.m. |
OK |
MS C++ |
TESTS |
36 |
30 |
0 |
|
2200 |
4671056 |
yokozuna57 |
E |
Oct. 4, 2013, 5:20 p.m. |
OK |
MS C++ |
TESTS |
36 |
30 |
0 |
|
2200 |
4671022 |
vml |
E |
Oct. 4, 2013, 5:20 p.m. |
OK |
MS C++ |
TESTS |
36 |
30 |
0 |
|
2200 |
4670354 |
olpetOdessaONU |
E |
Oct. 4, 2013, 5:12 p.m. |
OK |
MS C++ |
TESTS |
36 |
30 |
0 |
|
2200 |
4667765 |
cfy |
E |
Oct. 4, 2013, 4:45 p.m. |
OK |
MS C++ |
TESTS |
36 |
30 |
0 |
|
2200 |
9401041 |
Apple_Cplus |
E |
Jan. 11, 2015, 5:24 a.m. |
OK |
MS C++ |
TESTS |
36 |
30 |
102400 |
|
2200 |
66984837 |
pikachan14 |
E |
Dec. 15, 2019, 5:42 p.m. |
OK |
MS C++ 2017 |
TESTS |
36 |
92 |
307200 |
|
2200 |
63539191 |
pajenegod |
E |
Oct. 27, 2019, 9:04 a.m. |
OK |
PyPy 2 |
TESTS |
36 |
560 |
4608000 |
|
2200 |
31048182 |
hiram1122 |
E |
Oct. 5, 2017, 10:17 p.m. |
OK |
Python 2 |
TESTS |
36 |
124 |
409600 |
|
2200 |
4673331 |
nwi |
E |
Oct. 4, 2013, 6:11 p.m. |
OK |
Python 2 |
TESTS |
36 |
156 |
1024000 |
|
2200 |
31047942 |
hiram1122 |
E |
Oct. 5, 2017, 9:57 p.m. |
OK |
Python 2 |
TESTS |
36 |
1372 |
512000 |
|
2200 |
31047930 |
hiram1122 |
E |
Oct. 5, 2017, 9:56 p.m. |
OK |
Python 2 |
TESTS |
36 |
1590 |
409600 |
|
2200 |
4952194 |
nealzane |
E |
Nov. 1, 2013, 3:43 p.m. |
OK |
Python 2 |
TESTS |
36 |
1652 |
409600 |
|
2200 |
4705995 |
equation314 |
E |
Oct. 8, 2013, 4:35 a.m. |
OK |
Python 2 |
TESTS |
36 |
1716 |
0 |
|
2200 |
4705980 |
equation314 |
E |
Oct. 8, 2013, 4:31 a.m. |
OK |
Python 2 |
TESTS |
36 |
1716 |
0 |
|
2200 |
5205553 |
sickplay |
E |
Nov. 24, 2013, 3:21 a.m. |
OK |
Python 2 |
TESTS |
36 |
1746 |
0 |
|
2200 |
5486171 |
coko156 |
E |
Dec. 21, 2013, 9:52 a.m. |
OK |
Python 2 |
TESTS |
36 |
1746 |
102400 |
|
2200 |
5486163 |
coko156 |
E |
Dec. 21, 2013, 9:50 a.m. |
OK |
Python 2 |
TESTS |
36 |
1746 |
102400 |
|
2200 |
12311662 |
vjudge5 |
E |
Aug. 2, 2015, 7:07 a.m. |
OK |
Python 3 |
TESTS |
36 |
1216 |
819200 |
|
2200 |
12311660 |
Ryan_MuQ |
E |
Aug. 2, 2015, 7:07 a.m. |
OK |
Python 3 |
TESTS |
36 |
1246 |
921600 |
|
2200 |
64436674 |
jrodrigues |
E |
Nov. 7, 2019, 1:48 a.m. |
OK |
Rust |
TESTS |
36 |
92 |
0 |
|
2200 |
remove filters
Back to search problems