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.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
---|---|---|---|---|---|---|
1760 | Codeforces Round 835 (Div. 4) | FINISHED | False | 8700 | 62781899 | Nov. 21, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 20508 ) | E | Binary Inversions | PROGRAMMING | data structures greedy math |
B'You are given a binary array ^{ dagger} of length n . You are allowed to perform one operation on it at most once. In an operation, you can choose any element and flip it: turn a 0 into a 1 or vice-versa. What is the maximum number of inversions ^{ ddagger} the array can have after performing at most one operation? ^ dagger A binary array is an array that contains only zeroes and ones. ^ ddagger The number of inversions in an array is the number of pairs of indices i,j such that i<j and a_i > a_j . The input consists of multiple test cases. The first line contains an integer t ( 1 <= q t <= q 10^4 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains an integer n ( 1 <= q n <= q 2 cdot10^5 ) -- the length of the array. The following line contains n space-separated positive integers a_1 , a_2 ,..., a_n ( 0 <= q a_i <= q 1 ) -- the elements of the array. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot10^5 . For each test case, output a single integer -- the maximum number of inversions the array can have after performing at most one operation. For the first test case, the inversions are initially formed by the pairs of indices ( 1, 2 ), ( 1, 4 ), ( 3, 4 ), being a total of 3 , which already is the maximum possible. For the second test case, the inversions are initially formed by the pairs of indices ( 2, 3 ), ( 2, 4 ), ( 2, 6 ), ( 5, 6 ), being a total of four. But, by flipping the first element, the array becomes {1, 1, 0, 0, 1, 0} , which has the inversions formed by the pairs of indices ( 1, 3 ), ( 1, 4 ), ( 1, 6 ), ( 2, 3 ), ( 2, 4 ), ( 2, 6 ), ( 5, 6 ) which total to 7 inversions which is the maximum possible. '... |
109348 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
182051384 | WAAAAAAAAAAAAAAAAAAAAA | E | Nov. 21, 2022, 7:11 p.m. | OK | C# 10 | TESTS | 15 | 93 | 19968000 | ||
182075164 | chrisfcoder | E | Nov. 22, 2022, 1:40 a.m. | OK | C# 10 | TESTS | 15 | 170 | 22323200 | ||
182040384 | ruban | E | Nov. 21, 2022, 5:30 p.m. | OK | FPC | TESTS | 15 | 46 | 163123200 | ||
182066458 | hyf_hhh | E | Nov. 22, 2022, 12:06 a.m. | OK | GNU C11 | TESTS | 15 | 46 | 819200 | ||
182086907 | ylyh | E | Nov. 22, 2022, 5:14 a.m. | OK | GNU C11 | TESTS | 15 | 46 | 819200 | ||
182039575 | yurui111 | E | Nov. 21, 2022, 5:25 p.m. | OK | GNU C11 | TESTS | 15 | 46 | 819200 | ||
182048018 | nestor_makhno | E | Nov. 21, 2022, 6:35 p.m. | OK | GNU C11 | TESTS | 15 | 46 | 819200 | ||
182047710 | awsaf1825 | E | Nov. 21, 2022, 6:32 p.m. | OK | GNU C11 | TESTS | 15 | 46 | 819200 | ||
182042706 | Nightmarexx1 | E | Nov. 21, 2022, 5:47 p.m. | OK | GNU C11 | TESTS | 15 | 61 | 2355200 | ||
182079412 | TJSW | E | Nov. 22, 2022, 3:06 a.m. | OK | GNU C11 | TESTS | 15 | 61 | 3174400 | ||
182038695 | Interested | E | Nov. 21, 2022, 5:20 p.m. | OK | GNU C11 | TESTS | 15 | 62 | 819200 | ||
182037028 | Remijang | E | Nov. 21, 2022, 5:11 p.m. | OK | GNU C11 | TESTS | 15 | 62 | 819200 | ||
182066317 | xingke233 | E | Nov. 22, 2022, 12:01 a.m. | OK | GNU C++14 | TESTS | 15 | 31 | 1638400 | ||
182077249 | Lambent_Light | E | Nov. 22, 2022, 2:24 a.m. | OK | GNU C++14 | TESTS | 15 | 31 | 2457600 | ||
182035029 | asuka24601 | E | Nov. 21, 2022, 5:02 p.m. | OK | GNU C++14 | TESTS | 15 | 31 | 3174400 | ||
182048416 | Mhamad_aboaljood | E | Nov. 21, 2022, 6:39 p.m. | OK | GNU C++14 | TESTS | 15 | 46 | 204800 | ||
182084946 | AIM-9M | E | Nov. 22, 2022, 4:41 a.m. | OK | GNU C++14 | TESTS | 15 | 46 | 819200 | ||
182082211 | anishjain2812 | E | Nov. 22, 2022, 3:50 a.m. | OK | GNU C++14 | TESTS | 15 | 46 | 819200 | ||
182080448 | ATkong | E | Nov. 22, 2022, 3:18 a.m. | OK | GNU C++14 | TESTS | 15 | 46 | 819200 | ||
182079554 | bxdebb | E | Nov. 22, 2022, 3:09 a.m. | OK | GNU C++14 | TESTS | 15 | 46 | 819200 | ||
182089505 | swimming. | E | Nov. 22, 2022, 5:52 a.m. | OK | GNU C++14 | TESTS | 15 | 46 | 819200 | ||
182089903 | _wh | E | Nov. 22, 2022, 5:58 a.m. | OK | GNU C++14 | TESTS | 15 | 46 | 819200 | ||
182068130 | ff_666 | E | Nov. 22, 2022, 12:54 a.m. | OK | GNU C++17 | TESTS | 15 | 31 | 2662400 | ||
182078576 | SnuSik | E | Nov. 22, 2022, 2:49 a.m. | OK | GNU C++17 | TESTS | 15 | 31 | 6451200 | ||
182083138 | saintrock | E | Nov. 22, 2022, 4:08 a.m. | OK | GNU C++17 | TESTS | 15 | 46 | 0 | ||
182082661 | saintrock | E | Nov. 22, 2022, 3:59 a.m. | OK | GNU C++17 | TESTS | 15 | 46 | 0 | ||
182082086 | saintrock | E | Nov. 22, 2022, 3:48 a.m. | OK | GNU C++17 | TESTS | 15 | 46 | 0 | ||
182082744 | saintrock | E | Nov. 22, 2022, 4 a.m. | OK | GNU C++17 | TESTS | 15 | 46 | 0 | ||
182085259 | obitoUchiha13 | E | Nov. 22, 2022, 4:46 a.m. | OK | GNU C++17 | TESTS | 15 | 46 | 0 | ||
182066961 | RSA00 | E | Nov. 22, 2022, 12:22 a.m. | OK | GNU C++17 | TESTS | 15 | 46 | 204800 | ||
182081034 | GreatLiangpi | E | Nov. 22, 2022, 3:28 a.m. | OK | GNU C++17 | TESTS | 15 | 46 | 204800 | ||
182089795 | S1LVERLining | E | Nov. 22, 2022, 5:56 a.m. | OK | GNU C++17 | TESTS | 15 | 46 | 409600 | ||
182038464 | TsotneSC | E | Nov. 21, 2022, 5:18 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 30 | 1331200 | ||
182049868 | urBCI | E | Nov. 21, 2022, 6:54 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 31 | 819200 | ||
182075476 | PCC | E | Nov. 22, 2022, 1:47 a.m. | OK | GNU C++17 (64) | TESTS | 15 | 31 | 819200 | ||
182045253 | donald_duck123 | E | Nov. 21, 2022, 6:08 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 31 | 1536000 | ||
182061131 | moo. | E | Nov. 21, 2022, 9:41 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 31 | 1638400 | ||
182056969 | enslaved | E | Nov. 21, 2022, 8:24 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 31 | 2457600 | ||
182071636 | Clash7 | E | Nov. 22, 2022, 1:30 a.m. | OK | GNU C++17 (64) | TESTS | 15 | 31 | 2457600 | ||
182070445 | Awesome3.14 | E | Nov. 22, 2022, 1:29 a.m. | OK | GNU C++17 (64) | TESTS | 15 | 31 | 2457600 | ||
182048930 | kevinyang uwu | E | Nov. 21, 2022, 6:44 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 31 | 2457600 | ||
182043782 | ScarletS | E | Nov. 21, 2022, 5:56 p.m. | OK | GNU C++17 (64) | TESTS | 15 | 31 | 2457600 | ||
182054826 | Ahmad_Nour_Haidar | E | Nov. 21, 2022, 7:53 p.m. | OK | GNU C++20 (64) | TESTS | 15 | 15 | 204800 | ||
182038191 | SAYANJIT7 | E | Nov. 21, 2022, 5:17 p.m. | OK | GNU C++20 (64) | TESTS | 15 | 15 | 4915200 | ||
182044698 | Mahmoud_Qassem | E | Nov. 21, 2022, 6:04 p.m. | OK | GNU C++20 (64) | TESTS | 15 | 31 | 409600 | ||
182085773 | Rahatabir | E | Nov. 22, 2022, 4:55 a.m. | OK | GNU C++20 (64) | TESTS | 15 | 31 | 819200 | ||
182085942 | aryan1602 | E | Nov. 22, 2022, 4:58 a.m. | OK | GNU C++20 (64) | TESTS | 15 | 31 | 819200 | ||
182088779 | middlepenguin | E | Nov. 22, 2022, 5:42 a.m. | OK | GNU C++20 (64) | TESTS | 15 | 31 | 819200 | ||
182090161 | algorhyythm | E | Nov. 22, 2022, 6:02 a.m. | OK | GNU C++20 (64) | TESTS | 15 | 31 | 819200 | ||
182082550 | Tanvirrafi | E | Nov. 22, 2022, 3:57 a.m. | OK | GNU C++20 (64) | TESTS | 15 | 31 | 819200 | ||
182082737 | ldbbb2001 | E | Nov. 22, 2022, 4 a.m. | OK | GNU C++20 (64) | TESTS | 15 | 31 | 819200 | ||
182083071 | willsoon | E | Nov. 22, 2022, 4:06 a.m. | OK | GNU C++20 (64) | TESTS | 15 | 31 | 819200 | ||
182063517 | shiro | E | Nov. 21, 2022, 10:36 p.m. | OK | Go | TESTS | 15 | 77 | 5120000 | ||
182083943 | rajneesh.osho | E | Nov. 22, 2022, 4:22 a.m. | OK | Java 11 | TESTS | 15 | 171 | 0 | ||
182052782 | ItsZaki | E | Nov. 21, 2022, 7:27 p.m. | OK | Java 11 | TESTS | 15 | 186 | 0 | ||
182046635 | vijender_8601 | E | Nov. 21, 2022, 6:21 p.m. | OK | Java 11 | TESTS | 15 | 187 | 0 | ||
182089202 | pakkapapad | E | Nov. 22, 2022, 5:48 a.m. | OK | Java 11 | TESTS | 15 | 202 | 0 | ||
182064856 | Yousef_Badr | E | Nov. 21, 2022, 11:14 p.m. | OK | Java 11 | TESTS | 15 | 202 | 0 | ||
182052233 | ItsZaki | E | Nov. 21, 2022, 7:21 p.m. | OK | Java 11 | TESTS | 15 | 202 | 0 | ||
182039283 | nonesl | E | Nov. 21, 2022, 5:23 p.m. | OK | Java 11 | TESTS | 15 | 202 | 0 | ||
182038874 | harsh.bhandari.v | E | Nov. 21, 2022, 5:21 p.m. | OK | Java 11 | TESTS | 15 | 233 | 0 | ||
182066579 | Kryuchkovm23 | E | Nov. 22, 2022, 12:10 a.m. | OK | Java 11 | TESTS | 15 | 233 | 0 | ||
182062425 | Abdelrahim303 | E | Nov. 21, 2022, 10:08 p.m. | OK | Java 11 | TESTS | 15 | 233 | 0 | ||
182037061 | _Abeke_ | E | Nov. 21, 2022, 5:12 p.m. | OK | Java 17 | TESTS | 15 | 202 | 307200 | ||
182085635 | sharadtandale2878 | E | Nov. 22, 2022, 4:53 a.m. | OK | Java 17 | TESTS | 15 | 217 | 512000 | ||
182037927 | Badass_Nemesis | E | Nov. 21, 2022, 5:16 p.m. | OK | Java 17 | TESTS | 15 | 218 | 819200 | ||
182083364 | Thejas_n | E | Nov. 22, 2022, 4:12 a.m. | OK | Java 17 | TESTS | 15 | 218 | 921600 | ||
182040037 | Eslam_Ahmed | E | Nov. 21, 2022, 5:27 p.m. | OK | Java 17 | TESTS | 15 | 249 | 716800 | ||
182081130 | _lwq_123_ | E | Nov. 22, 2022, 3:30 a.m. | OK | Java 17 | TESTS | 15 | 265 | 614400 | ||
182051382 | MThiaweng | E | Nov. 21, 2022, 7:11 p.m. | OK | Java 17 | TESTS | 15 | 390 | 15769600 | ||
182085380 | sydbrs | E | Nov. 22, 2022, 4:49 a.m. | OK | Java 17 | TESTS | 15 | 436 | 716800 | ||
182089883 | Suraj1607 | E | Nov. 22, 2022, 5:58 a.m. | OK | Java 17 | TESTS | 15 | 452 | 1024000 | ||
182087498 | kumarvikash | E | Nov. 22, 2022, 5:23 a.m. | OK | Java 17 | TESTS | 15 | 498 | 5222400 | ||
182089100 | ahmedtawfik | E | Nov. 22, 2022, 5:47 a.m. | OK | Java 8 | TESTS | 15 | 108 | 0 | ||
182038612 | Koka | E | Nov. 21, 2022, 5:19 p.m. | OK | Java 8 | TESTS | 15 | 109 | 307200 | ||
182064027 | mohamedhassan_c | E | Nov. 21, 2022, 10:51 p.m. | OK | Java 8 | TESTS | 15 | 124 | 0 | ||
182056908 | raj_shahh | E | Nov. 21, 2022, 8:23 p.m. | OK | Java 8 | TESTS | 15 | 124 | 0 | ||
182052559 | Imran435 | E | Nov. 21, 2022, 7:25 p.m. | OK | Java 8 | TESTS | 15 | 124 | 0 | ||
182075449 | cys02 | E | Nov. 22, 2022, 1:47 a.m. | OK | Java 8 | TESTS | 15 | 139 | 0 | ||
182037097 | Parimal | E | Nov. 21, 2022, 5:12 p.m. | OK | Java 8 | TESTS | 15 | 139 | 0 | ||
182076522 | Zarby9834 | E | Nov. 22, 2022, 2:10 a.m. | OK | Java 8 | TESTS | 15 | 171 | 0 | ||
182035242 | Tac1337 | E | Nov. 21, 2022, 5:03 p.m. | OK | Java 8 | TESTS | 15 | 202 | 41472000 | ||
182037862 | Kaldaruly | E | Nov. 21, 2022, 5:16 p.m. | OK | Java 8 | TESTS | 15 | 202 | 76800000 | ||
182061471 | Kay0 | E | Nov. 21, 2022, 9:48 p.m. | OK | Kotlin 1.6 | TESTS | 15 | 280 | 5427200 | ||
182061944 | Kay0 | E | Nov. 21, 2022, 9:58 p.m. | OK | Kotlin 1.6 | TESTS | 15 | 296 | 5427200 | ||
182042176 | Faber | E | Nov. 21, 2022, 5:43 p.m. | OK | Kotlin 1.7 | TESTS | 15 | 545 | 57753600 | ||
182044816 | timusmanovs | E | Nov. 21, 2022, 6:05 p.m. | OK | MS C++ 2017 | TESTS | 15 | 109 | 409600 | ||
182082239 | LoTFe | E | Nov. 22, 2022, 3:51 a.m. | OK | MS C++ 2017 | TESTS | 15 | 109 | 1638400 | ||
182041070 | chopin123 | E | Nov. 21, 2022, 5:35 p.m. | OK | MS C++ 2017 | TESTS | 15 | 124 | 2457600 | ||
182039708 | D_S_O_ | E | Nov. 21, 2022, 5:26 p.m. | OK | MS C++ 2017 | TESTS | 15 | 124 | 4812800 | ||
182081286 | lyg3715371537 | E | Nov. 22, 2022, 3:32 a.m. | OK | MS C++ 2017 | TESTS | 15 | 140 | 3174400 | ||
182039437 | Electrony | E | Nov. 21, 2022, 5:24 p.m. | OK | MS C++ 2017 | TESTS | 15 | 140 | 4915200 | ||
182040460 | osato | E | Nov. 21, 2022, 5:30 p.m. | OK | Node.js | TESTS | 15 | 327 | 31641600 | ||
182058997 | rsFalse | E | Nov. 21, 2022, 8:59 p.m. | OK | Perl | TESTS | 15 | 296 | 44544000 | ||
182060386 | rsFalse | E | Nov. 21, 2022, 9:25 p.m. | OK | Perl | TESTS | 15 | 420 | 30310400 | ||
182060279 | rsFalse | E | Nov. 21, 2022, 9:23 p.m. | OK | Perl | TESTS | 15 | 436 | 30515200 | ||
182089619 | n.n.n.kz | E | Nov. 22, 2022, 5:54 a.m. | OK | PHP | TESTS | 15 | 93 | 50483200 | ||
182089830 | adwait_hegde | E | Nov. 22, 2022, 5:57 a.m. | OK | PyPy 3 | TESTS | 15 | 155 | 11366400 | ||
182076681 | Baibars | E | Nov. 22, 2022, 2:13 a.m. | OK | PyPy 3 | TESTS | 15 | 187 | 13824000 | ||
182069966 | dwaraganathan15 | E | Nov. 22, 2022, 1:16 a.m. | OK | PyPy 3 | TESTS | 15 | 327 | 18841600 | ||
182036369 | feronest | E | Nov. 21, 2022, 5:08 p.m. | OK | PyPy 3 | TESTS | 15 | 358 | 15872000 | ||
182040056 | Sp00kiel | E | Nov. 21, 2022, 5:28 p.m. | OK | PyPy 3 | TESTS | 15 | 405 | 18739200 | ||
182046145 | Sandeepk_1729 | E | Nov. 21, 2022, 6:17 p.m. | OK | PyPy 3 | TESTS | 15 | 452 | 14131200 | ||
182085394 | stephenx7 | E | Nov. 22, 2022, 4:49 a.m. | OK | PyPy 3 | TESTS | 15 | 514 | 18841600 | ||
182063039 | haydenhyoung | E | Nov. 21, 2022, 10:24 p.m. | OK | PyPy 3-64 | TESTS | 15 | 93 | 22016000 | ||
182071615 | crapcode | E | Nov. 22, 2022, 1:30 a.m. | OK | PyPy 3-64 | TESTS | 15 | 108 | 21094400 | ||
182065738 | biglunchdude | E | Nov. 21, 2022, 11:41 p.m. | OK | PyPy 3-64 | TESTS | 15 | 109 | 22016000 | ||
182070408 | crapcode | E | Nov. 22, 2022, 1:27 a.m. | OK | PyPy 3-64 | TESTS | 15 | 124 | 21094400 | ||
182064168 | nealzane | E | Nov. 21, 2022, 10:54 p.m. | OK | PyPy 3-64 | TESTS | 15 | 124 | 21196800 | ||
182066135 | biglunchdude | E | Nov. 21, 2022, 11:55 p.m. | OK | PyPy 3-64 | TESTS | 15 | 124 | 22118400 | ||
182069023 | mikeac | E | Nov. 22, 2022, 1:14 a.m. | OK | PyPy 3-64 | TESTS | 15 | 140 | 22323200 | ||
182069949 | mikeac | E | Nov. 22, 2022, 1:16 a.m. | OK | PyPy 3-64 | TESTS | 15 | 140 | 22528000 | ||
182034836 | Endu | E | Nov. 21, 2022, 5:02 p.m. | OK | PyPy 3-64 | TESTS | 15 | 155 | 29900800 | ||
182085082 | cholebhature | E | Nov. 22, 2022, 4:43 a.m. | OK | PyPy 3-64 | TESTS | 15 | 155 | 31436800 | ||
182086943 | orazbek | E | Nov. 22, 2022, 5:14 a.m. | OK | Python 3 | TESTS | 15 | 155 | 3788800 | ||
182040652 | Dinoh_Sandys | E | Nov. 21, 2022, 5:32 p.m. | OK | Python 3 | TESTS | 15 | 155 | 3891200 | ||
182052341 | Karasick | E | Nov. 21, 2022, 7:22 p.m. | OK | Python 3 | TESTS | 15 | 155 | 3993600 | ||
182037724 | gokulraaj59 | E | Nov. 21, 2022, 5:15 p.m. | OK | Python 3 | TESTS | 15 | 155 | 3993600 | ||
182053936 | torqueaj | E | Nov. 21, 2022, 7:41 p.m. | OK | Python 3 | TESTS | 15 | 171 | 3891200 | ||
182052580 | jekahamster | E | Nov. 21, 2022, 7:25 p.m. | OK | Python 3 | TESTS | 15 | 171 | 3993600 | ||
182048513 | Ratery | E | Nov. 21, 2022, 6:40 p.m. | OK | Python 3 | TESTS | 15 | 171 | 3993600 | ||
182036062 | HexClan-WitchFinder | E | Nov. 21, 2022, 5:07 p.m. | OK | Python 3 | TESTS | 15 | 171 | 3993600 | ||
182086344 | mahmoud.mahmoud | E | Nov. 22, 2022, 5:04 a.m. | OK | Python 3 | TESTS | 15 | 171 | 4710400 | ||
182089811 | aashu.patidar9876 | E | Nov. 22, 2022, 5:57 a.m. | OK | Python 3 | TESTS | 15 | 186 | 3788800 | ||
182048988 | nikgaevoy | E | Nov. 21, 2022, 6:44 p.m. | OK | Rust 2021 | TESTS | 15 | 77 | 14028800 |
Back to search problems