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 |
---|---|---|---|---|---|---|
1601 | Codeforces Round 751 (Div. 1) | FINISHED | False | 7200 | 102036263 | Oct. 25, 2021, 6:35 a.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 2086 ) | C | Optimal Insertion | PROGRAMMING | data structures divide and conquer greedy sortings | 2300 |
B"You are given two arrays of integers a_1, a_2, ldots, a_n and b_1, b_2, ldots, b_m . You need to insert all elements of b into a in an arbitrary way. As a result you will get an array c_1, c_2, ldots, c_{n+m} of size n + m . Note that you are not allowed to change the order of elements in a , while you can insert elements of b at arbitrary positions. They can be inserted at the beginning, between any elements of a , or at the end. Moreover, elements of b can appear in the resulting array in any order. What is the minimum possible number of inversions in the resulting array c ? Recall that an inversion is a pair of indices (i, j) such that i < j and c_i > c_j . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= q t <= q 10^4 ). Description of the test cases follows. The first line of each test case contains two integers n and m ( 1 <= q n, m <= q 10^6 ). The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 1 <= q a_i <= q 10^9 ). The third line of each test case contains m integers b_1, b_2, ldots, b_m ( 1 <= q b_i <= q 10^9 ). It is guaranteed that the sum of n for all tests cases in one input doesn't exceed 10^6 . The sum of m for all tests cases doesn't exceed 10^6 as well. For each test case, print one integer -- the minimum possible number of inversions in the resulting array c . Below is given the solution to get the optimal answer for each of the example test cases (elements of a are underscored). "... |
95865 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
133099756 | rainboy | C | Oct. 25, 2021, 6:47 p.m. | OK | GNU C11 | TESTS | 20 | 936 | 43827200 | 2300 | |
133065311 | yyyyxh | C | Oct. 25, 2021, 1:07 p.m. | OK | GNU C++14 | TESTS | 20 | 389 | 25395200 | 2300 | |
133060792 | kaiming_xxy | C | Oct. 25, 2021, 12:25 p.m. | OK | GNU C++14 | TESTS | 20 | 810 | 41472000 | 2300 | |
133007082 | caoyue | C | Oct. 25, 2021, 7:39 a.m. | OK | GNU C++14 | TESTS | 20 | 842 | 41164800 | 2300 | |
133045404 | get_r_ight | C | Oct. 25, 2021, 9:44 a.m. | OK | GNU C++14 | TESTS | 20 | 919 | 209203200 | 2300 | |
133107168 | Deaga | C | Oct. 25, 2021, 9:23 p.m. | OK | GNU C++14 | TESTS | 20 | 997 | 61235200 | 2300 | |
133101008 | rainboy | C | Oct. 25, 2021, 7:10 p.m. | OK | GNU C++14 | TESTS | 20 | 1029 | 41164800 | 2300 | |
133077771 | xueyijie | C | Oct. 25, 2021, 3:05 p.m. | OK | GNU C++14 | TESTS | 20 | 1060 | 33177600 | 2300 | |
133071901 | Larry0101 | C | Oct. 25, 2021, 2:15 p.m. | OK | GNU C++14 | TESTS | 20 | 1076 | 34099200 | 2300 | |
133115319 | hydd | C | Oct. 26, 2021, 2:45 a.m. | OK | GNU C++14 | TESTS | 20 | 1076 | 39526400 | 2300 | |
133067262 | maoyiting | C | Oct. 25, 2021, 1:28 p.m. | OK | GNU C++14 | TESTS | 20 | 1154 | 45158400 | 2300 | |
133065353 | FHVirus | C | Oct. 25, 2021, 1:08 p.m. | OK | GNU C++17 | TESTS | 20 | 717 | 17203200 | 2300 | |
133052031 | dknguyen176 | C | Oct. 25, 2021, 10:59 a.m. | OK | GNU C++17 | TESTS | 20 | 904 | 41164800 | 2300 | |
133017402 | DPair | C | Oct. 25, 2021, 8:09 a.m. | OK | GNU C++17 | TESTS | 20 | 951 | 61747200 | 2300 | |
133020502 | Mamedov | C | Oct. 25, 2021, 8:17 a.m. | OK | GNU C++17 | TESTS | 20 | 982 | 37580800 | 2300 | |
133002651 | izone | C | Oct. 25, 2021, 7:21 a.m. | OK | GNU C++17 | TESTS | 20 | 997 | 34201600 | 2300 | |
132999482 | djq_cpp | C | Oct. 25, 2021, 7:09 a.m. | OK | GNU C++17 | TESTS | 20 | 1138 | 34099200 | 2300 | |
133068477 | AlperenT | C | Oct. 25, 2021, 1:39 p.m. | OK | GNU C++17 | TESTS | 20 | 1184 | 106905600 | 2300 | |
133112534 | northbank | C | Oct. 26, 2021, 1:19 a.m. | OK | GNU C++17 | TESTS | 20 | 1185 | 45158400 | 2300 | |
133058292 | LptN21 | C | Oct. 25, 2021, 12:04 p.m. | OK | GNU C++17 | TESTS | 20 | 1200 | 49766400 | 2300 | |
133054059 | Elo | C | Oct. 25, 2021, 11:21 a.m. | OK | GNU C++17 | TESTS | 20 | 1200 | 61337600 | 2300 | |
133110969 | WeakestTopology | C | Oct. 26, 2021, 12:21 a.m. | OK | GNU C++17 (64) | TESTS | 20 | 670 | 73420800 | 2300 | |
133100892 | rainboy | C | Oct. 25, 2021, 7:08 p.m. | OK | GNU C++17 (64) | TESTS | 20 | 857 | 41267200 | 2300 | |
133054085 | Elo | C | Oct. 25, 2021, 11:21 a.m. | OK | GNU C++17 (64) | TESTS | 20 | 904 | 73625600 | 2300 | |
133053178 | Fysty | C | Oct. 25, 2021, 11:12 a.m. | OK | GNU C++17 (64) | TESTS | 20 | 904 | 131788800 | 2300 | |
133023294 | DmitryGrigorev | C | Oct. 25, 2021, 8:20 a.m. | OK | GNU C++17 (64) | TESTS | 20 | 920 | 50790400 | 2300 | |
133102584 | devinqu | C | Oct. 25, 2021, 7:38 p.m. | OK | GNU C++17 (64) | TESTS | 20 | 950 | 46796800 | 2300 | |
133115490 | Starline | C | Oct. 26, 2021, 2:50 a.m. | OK | GNU C++17 (64) | TESTS | 20 | 998 | 69120000 | 2300 | |
133108574 | willy108 | C | Oct. 25, 2021, 10:17 p.m. | OK | GNU C++17 (64) | TESTS | 20 | 1013 | 101068800 | 2300 | |
133023120 | XYFAN | C | Oct. 25, 2021, 8:20 a.m. | OK | GNU C++17 (64) | TESTS | 20 | 1013 | 119500800 | 2300 | |
133003100 | basic_string | C | Oct. 25, 2021, 7:23 a.m. | OK | GNU C++17 (64) | TESTS | 20 | 1029 | 41267200 | 2300 | |
133045398 | HollwoQ_Pelw | C | Oct. 25, 2021, 9:44 a.m. | OK | GNU C++20 (64) | TESTS | 20 | 810 | 24678400 | 2300 | |
133014796 | erray | C | Oct. 25, 2021, 8:03 a.m. | OK | GNU C++20 (64) | TESTS | 20 | 826 | 30617600 | 2300 | |
133052940 | Alphagocc | C | Oct. 25, 2021, 11:09 a.m. | OK | GNU C++20 (64) | TESTS | 20 | 826 | 113664000 | 2300 | |
133050667 | Elo | C | Oct. 25, 2021, 10:43 a.m. | OK | GNU C++20 (64) | TESTS | 20 | 842 | 73625600 | 2300 | |
133051202 | Elo | C | Oct. 25, 2021, 10:50 a.m. | OK | GNU C++20 (64) | TESTS | 20 | 857 | 73625600 | 2300 | |
133053093 | Alphagocc | C | Oct. 25, 2021, 11:11 a.m. | OK | GNU C++20 (64) | TESTS | 20 | 872 | 113664000 | 2300 | |
133051043 | Elo | C | Oct. 25, 2021, 10:47 a.m. | OK | GNU C++20 (64) | TESTS | 20 | 873 | 73625600 | 2300 | |
133053542 | Alphagocc | C | Oct. 25, 2021, 11:15 a.m. | OK | GNU C++20 (64) | TESTS | 20 | 888 | 113664000 | 2300 | |
133061070 | kaiming_xxy | C | Oct. 25, 2021, 12:28 p.m. | OK | GNU C++20 (64) | TESTS | 20 | 904 | 41267200 | 2300 | |
133010693 | zhouhuanyi | C | Oct. 25, 2021, 7:55 a.m. | OK | GNU C++20 (64) | TESTS | 20 | 920 | 57344000 | 2300 | |
133068964 | dalt | C | Oct. 25, 2021, 1:44 p.m. | OK | Java 11 | TESTS | 20 | 1216 | 78848000 | 2300 | |
133002919 | uwi | C | Oct. 25, 2021, 7:22 a.m. | OK | Java 11 | TESTS | 20 | 2854 | 93184000 | 2300 | |
133010412 | LoneFox | C | Oct. 25, 2021, 7:54 a.m. | OK | MS C++ 2017 | TESTS | 20 | 1731 | 39014400 | 2300 | |
133080527 | forest | C | Oct. 25, 2021, 3:36 p.m. | OK | MS C++ 2017 | TESTS | 20 | 2215 | 38912000 | 2300 | |
133050747 | r57shell | C | Oct. 25, 2021, 10:44 a.m. | OK | MS C++ 2017 | TESTS | 20 | 2355 | 133017600 | 2300 | |
133049306 | caan_do | C | Oct. 25, 2021, 10:28 a.m. | OK | PyPy 3-64 | TESTS | 20 | 2308 | 266035200 | 2300 | |
133049580 | huikang | C | Oct. 25, 2021, 10:31 a.m. | OK | PyPy 3-64 | TESTS | 20 | 2371 | 265011200 | 2300 | |
133050052 | huikang | C | Oct. 25, 2021, 10:37 a.m. | OK | PyPy 3-64 | TESTS | 20 | 2917 | 265932800 | 2300 | |
133061952 | Spheniscine | C | Oct. 25, 2021, 12:36 p.m. | OK | Rust | TESTS | 20 | 826 | 42598400 | 2300 | |
133061133 | Spheniscine | C | Oct. 25, 2021, 12:29 p.m. | OK | Rust | TESTS | 20 | 889 | 42598400 | 2300 | |
133082732 | sansen | C | Oct. 25, 2021, 3:59 p.m. | OK | Rust | TESTS | 20 | 1075 | 118476800 | 2300 | |
133020342 | Spheniscine | C | Oct. 25, 2021, 8:17 a.m. | OK | Rust | TESTS | 20 | 1404 | 82739200 | 2300 |
Back to search problems