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 |
---|---|---|---|---|---|---|
1005 | Codeforces Round 496 (Div. 3) | FINISHED | False | 7200 | 206375124 | July 9, 2018, 3:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 3987 ) | E1 | Median on Segments (Permutations Edition) | PROGRAMMING | sortings | 1900 |
B'You are given a permutation p_1, p_2, ... , p_n . A permutation of length n is a sequence such that each integer between 1 and n occurs exactly once in the sequence. Find the number of pairs of indices (l, r) ( 1 <= l <= r <= n ) such that the value of the median of p_l, p_{l+1}, ... , p_r is exactly the given number m . The median of a sequence is the value of the element which is in the middle of the sequence after sorting it in non-decreasing order. If the length of the sequence is even, the left of two middle elements is used. For example, if a=[4, 2, 7, 5] then its median is 4 since after sorting the sequence, it will look like [2, 4, 5, 7] and the left of two middle elements is equal to 4 . The median of [7, 1, 2, 9, 6] equals 6 since after sorting, the value 6 will be in the middle of the sequence. Write a program to find the number of pairs of indices (l, r) ( 1 <= l <= r <= n ) such that the value of the median of p_l, p_{l+1}, ... , p_r is exactly the given number m . The first line contains integers n and m ( 1 <= n <= 2 cdot10^5 , 1 <= m <= n ) -- the length of the given sequence and the required value of the median. The second line contains a permutation p_1, p_2, ... , p_n ( 1 <= p_i <= n ). Each integer between 1 and n occurs in p exactly once. Print the required number. In the first example, the suitable pairs of indices are: (1, 3) , (2, 2) , (2, 3) and (2, 4) . '... |
Codeforces Round 496 (Div. 3): Problem Tutorials |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
64749458 | sash0 | E1 | Nov. 12, 2019, 2:42 p.m. | OK | D | TESTS | 51 | 109 | 36147200 | 1900 | |
42770223 | ndhuy | E1 | Sept. 11, 2018, 3:06 p.m. | OK | FPC | TESTS | 51 | 62 | 7270400 | 1900 | |
40545462 | vjudge4 | E1 | July 19, 2018, 11:26 a.m. | OK | GNU C++ | TESTS | 51 | 31 | 1433600 | 1900 | |
40232600 | Qing_LKYi | E1 | July 12, 2018, 12:54 p.m. | OK | GNU C++ | TESTS | 51 | 31 | 4608000 | 1900 | |
40931054 | Scut82 | E1 | July 30, 2018, 12:36 a.m. | OK | GNU C++ | TESTS | 51 | 31 | 8806400 | 1900 | |
40565921 | vjudge5 | E1 | July 20, 2018, 5:26 a.m. | OK | GNU C++ | TESTS | 51 | 46 | 614400 | 1900 | |
40545473 | vjudge5 | E1 | July 19, 2018, 11:26 a.m. | OK | GNU C++ | TESTS | 51 | 46 | 1433600 | 1900 | |
40773131 | zhtzht | E1 | July 26, 2018, 9:37 a.m. | OK | GNU C++ | TESTS | 51 | 46 | 3276800 | 1900 | |
40541323 | vjudge4 | E1 | July 19, 2018, 8:48 a.m. | OK | GNU C++ | TESTS | 51 | 61 | 1433600 | 1900 | |
40962280 | vjudge5 | E1 | July 30, 2018, 10:03 a.m. | OK | GNU C++ | TESTS | 51 | 61 | 2252800 | 1900 | |
40516040 | xiaohejun | E1 | July 18, 2018, 1:22 p.m. | OK | GNU C++ | TESTS | 51 | 61 | 7987200 | 1900 | |
40915409 | Scut82 | E1 | July 29, 2018, 11:25 a.m. | OK | GNU C++ | TESTS | 51 | 61 | 9625600 | 1900 | |
40178943 | LudwigVanBeethoven | E1 | July 10, 2018, 5:10 p.m. | OK | GNU C11 | TESTS | 51 | 62 | 2457600 | 1900 | |
41995610 | _23333 | E1 | Aug. 23, 2018, 11:56 a.m. | OK | GNU C++11 | TESTS | 51 | 31 | 4812800 | 1900 | |
61604783 | Ruby_Rose | E1 | Oct. 1, 2019, 12:19 p.m. | OK | GNU C++11 | TESTS | 51 | 31 | 16076800 | 1900 | |
56776340 | yoPrince | E1 | July 10, 2019, 2:51 a.m. | OK | GNU C++11 | TESTS | 51 | 46 | 1433600 | 1900 | |
54071966 | sunny_fei | E1 | May 13, 2019, 4:51 p.m. | OK | GNU C++11 | TESTS | 51 | 46 | 2457600 | 1900 | |
46813503 | henanliu | E1 | Dec. 9, 2018, 11:41 a.m. | OK | GNU C++11 | TESTS | 51 | 46 | 3276800 | 1900 | |
46813547 | henanliu | E1 | Dec. 9, 2018, 11:42 a.m. | OK | GNU C++11 | TESTS | 51 | 46 | 3276800 | 1900 | |
40261864 | maximumhanyu | E1 | July 13, 2018, 12:56 p.m. | OK | GNU C++11 | TESTS | 51 | 46 | 3993600 | 1900 | |
40731627 | ZED.LL | E1 | July 25, 2018, 7:53 a.m. | OK | GNU C++11 | TESTS | 51 | 46 | 8089600 | 1900 | |
59669147 | nwpu2018302329 | E1 | Aug. 29, 2019, 3:18 p.m. | OK | GNU C++11 | TESTS | 51 | 61 | 2457600 | 1900 | |
40223449 | Zarxdy34 | E1 | July 12, 2018, 7:40 a.m. | OK | GNU C++11 | TESTS | 51 | 61 | 2457600 | 1900 | |
40309145 | wangshu | E1 | July 14, 2018, 7:15 a.m. | OK | GNU C++14 | TESTS | 51 | 46 | 2457600 | 1900 | |
45787248 | wleung_bvg | E1 | Nov. 16, 2018, 3:18 a.m. | OK | GNU C++14 | TESTS | 51 | 46 | 2457600 | 1900 | |
40224316 | yangshuang | E1 | July 12, 2018, 8:08 a.m. | OK | GNU C++14 | TESTS | 51 | 62 | 2355200 | 1900 | |
51432729 | AMnu | E1 | March 18, 2019, 2:56 a.m. | OK | GNU C++14 | TESTS | 51 | 62 | 2457600 | 1900 | |
40550359 | ..vince | E1 | July 19, 2018, 2:03 p.m. | OK | GNU C++14 | TESTS | 51 | 62 | 2457600 | 1900 | |
40177534 | ivanzuki | E1 | July 10, 2018, 4:10 p.m. | OK | GNU C++14 | TESTS | 51 | 62 | 2457600 | 1900 | |
64278780 | gs18103 | E1 | Nov. 4, 2019, 11:56 p.m. | OK | GNU C++14 | TESTS | 51 | 62 | 2457600 | 1900 | |
49882157 | Anastasia146 | E1 | Feb. 13, 2019, 6:43 p.m. | OK | GNU C++14 | TESTS | 51 | 62 | 3174400 | 1900 | |
40220863 | swunbelievable | E1 | July 12, 2018, 6:22 a.m. | OK | GNU C++14 | TESTS | 51 | 62 | 3174400 | 1900 | |
46856555 | m4h | E1 | Dec. 10, 2018, 3:12 p.m. | OK | GNU C++14 | TESTS | 51 | 62 | 3174400 | 1900 | |
40212213 | stepvah | E1 | July 11, 2018, 9:34 p.m. | OK | GNU C++17 | TESTS | 51 | 46 | 200396800 | 1900 | |
65600232 | hinkopihpih | E1 | Nov. 23, 2019, 5:41 p.m. | OK | GNU C++17 | TESTS | 51 | 62 | 2355200 | 1900 | |
57439860 | PaciukZvichainyi | E1 | July 21, 2019, 6:24 a.m. | OK | GNU C++17 | TESTS | 51 | 62 | 2457600 | 1900 | |
66499395 | A_root_A | E1 | Dec. 8, 2019, 11:54 a.m. | OK | GNU C++17 | TESTS | 51 | 62 | 2457600 | 1900 | |
40238559 | Bassel | E1 | July 12, 2018, 4:47 p.m. | OK | GNU C++17 | TESTS | 51 | 62 | 3174400 | 1900 | |
40209392 | petko1998 | E1 | July 11, 2018, 5:55 p.m. | OK | GNU C++17 | TESTS | 51 | 62 | 3993600 | 1900 | |
49951585 | Dup4 | E1 | Feb. 15, 2019, 2:14 p.m. | OK | GNU C++17 | TESTS | 51 | 62 | 3993600 | 1900 | |
40894403 | tuyethoa1204 | E1 | July 28, 2018, 6:30 p.m. | OK | GNU C++17 | TESTS | 51 | 62 | 4812800 | 1900 | |
64319930 | BlueHya | E1 | Nov. 5, 2019, 3:18 p.m. | OK | GNU C++17 | TESTS | 51 | 62 | 4812800 | 1900 | |
53866043 | trungvthe130284 | E1 | May 8, 2019, 3:59 a.m. | OK | GNU C++17 | TESTS | 51 | 62 | 7987200 | 1900 | |
69217233 | GiantTornado | E1 | Jan. 21, 2020, 1:59 a.m. | OK | Java 11 | TESTS | 51 | 265 | 12390400 | 1900 | |
55985269 | caoash | E1 | June 24, 2019, 2:44 a.m. | OK | Java 8 | TESTS | 51 | 124 | 0 | 1900 | |
40221934 | uwi | E1 | July 12, 2018, 6:56 a.m. | OK | Java 8 | TESTS | 51 | 124 | 0 | 1900 | |
40234184 | In_The_Name_Of_Love | E1 | July 12, 2018, 1:49 p.m. | OK | Java 8 | TESTS | 51 | 140 | 0 | 1900 | |
40296549 | out_of_the_box | E1 | July 13, 2018, 8:39 p.m. | OK | Java 8 | TESTS | 51 | 171 | 4198400 | 1900 | |
40206471 | hack1nt0 | E1 | July 11, 2018, 3:53 p.m. | OK | Java 8 | TESTS | 51 | 171 | 9830400 | 1900 | |
51349825 | mikkk | E1 | March 15, 2019, 8:54 p.m. | OK | Java 8 | TESTS | 51 | 171 | 11673600 | 1900 | |
45326464 | wadissimo | E1 | Nov. 5, 2018, 1:11 p.m. | OK | Java 8 | TESTS | 51 | 186 | 14028800 | 1900 | |
55985295 | Java | E1 | June 24, 2019, 2:45 a.m. | OK | Java 8 | TESTS | 51 | 186 | 14131200 | 1900 | |
40172618 | bhautik_77 | E1 | July 10, 2018, 1:16 p.m. | OK | Java 8 | TESTS | 51 | 187 | 9932800 | 1900 | |
40408533 | DevilJin | E1 | July 16, 2018, 11:11 a.m. | OK | Java 8 | TESTS | 51 | 187 | 10649600 | 1900 | |
40781335 | user32 | E1 | July 26, 2018, 1:58 p.m. | OK | Kotlin | TESTS | 51 | 311 | 16076800 | 1900 | |
40192214 | ZALeo | E1 | July 11, 2018, 7:14 a.m. | OK | Kotlin | TESTS | 51 | 483 | 22220800 | 1900 | |
42892890 | vjudge2 | E1 | Sept. 15, 2018, 1:53 p.m. | OK | MS C++ | TESTS | 51 | 46 | 3174400 | 1900 | |
43288016 | vjudge3 | E1 | Sept. 23, 2018, 9:13 a.m. | OK | MS C++ | TESTS | 51 | 61 | 3174400 | 1900 | |
42888708 | vjudge1 | E1 | Sept. 15, 2018, 11:31 a.m. | OK | MS C++ | TESTS | 51 | 61 | 3174400 | 1900 | |
41379517 | scorpiowf | E1 | Aug. 9, 2018, 1:14 a.m. | OK | MS C++ | TESTS | 51 | 61 | 3379200 | 1900 | |
55648421 | vjudge3 | E1 | June 16, 2019, 1:21 p.m. | OK | MS C++ | TESTS | 51 | 61 | 11980800 | 1900 | |
42888671 | vjudge2 | E1 | Sept. 15, 2018, 11:30 a.m. | OK | MS C++ | TESTS | 51 | 62 | 2457600 | 1900 | |
42886141 | vjudge4 | E1 | Sept. 15, 2018, 10:01 a.m. | OK | MS C++ | TESTS | 51 | 62 | 3174400 | 1900 | |
42886128 | vjudge1 | E1 | Sept. 15, 2018, 10:01 a.m. | OK | MS C++ | TESTS | 51 | 62 | 3174400 | 1900 | |
42884435 | vjudge1 | E1 | Sept. 15, 2018, 8:56 a.m. | OK | MS C++ | TESTS | 51 | 62 | 3174400 | 1900 | |
42892787 | vjudge1 | E1 | Sept. 15, 2018, 1:49 p.m. | OK | MS C++ | TESTS | 51 | 62 | 3174400 | 1900 | |
50636368 | work_hard. | E1 | March 1, 2019, 11:59 a.m. | OK | MS C++ 2017 | TESTS | 51 | 109 | 7270400 | 1900 | |
40238853 | sk0 | E1 | July 12, 2018, 4:59 p.m. | OK | Ocaml | TESTS | 51 | 93 | 10035200 | 1900 | |
40765282 | Avtakhov | E1 | July 26, 2018, 6:07 a.m. | OK | PascalABC.NET | TESTS | 51 | 140 | 1843200 | 1900 | |
49111890 | mayakin | E1 | Jan. 28, 2019, 3:18 p.m. | OK | PHP | TESTS | 51 | 295 | 26828800 | 1900 | |
40262739 | sair | E1 | July 13, 2018, 1:14 p.m. | OK | PyPy 2 | TESTS | 51 | 202 | 16281600 | 1900 | |
47694318 | c1729 | E1 | Dec. 29, 2018, 4:10 p.m. | OK | PyPy 2 | TESTS | 51 | 202 | 24064000 | 1900 | |
62461976 | raj1307 | E1 | Oct. 13, 2019, 8:35 a.m. | OK | PyPy 2 | TESTS | 51 | 234 | 18227200 | 1900 | |
53739156 | Cifko | E1 | May 4, 2019, 12:46 p.m. | OK | PyPy 2 | TESTS | 51 | 264 | 18944000 | 1900 | |
42316840 | nns2009 | E1 | Aug. 31, 2018, 6 p.m. | OK | PyPy 3 | TESTS | 51 | 296 | 24780800 | 1900 | |
53712687 | yfo | E1 | May 3, 2019, 4:31 p.m. | OK | PyPy 3 | TESTS | 51 | 296 | 24985600 | 1900 | |
42220372 | LordVader | E1 | Aug. 28, 2018, 8:01 p.m. | OK | PyPy 3 | TESTS | 51 | 312 | 18329600 | 1900 | |
63034363 | Zombie358 | E1 | Oct. 20, 2019, 7:58 p.m. | OK | PyPy 3 | TESTS | 51 | 312 | 20377600 | 1900 | |
40749640 | atharva456 | E1 | July 25, 2018, 4:51 p.m. | OK | PyPy 3 | TESTS | 51 | 326 | 19148800 | 1900 | |
40749631 | limitbreaker37 | E1 | July 25, 2018, 4:51 p.m. | OK | PyPy 3 | TESTS | 51 | 326 | 19148800 | 1900 | |
55949723 | scambret | E1 | June 23, 2019, 12:03 a.m. | OK | PyPy 3 | TESTS | 51 | 327 | 21606400 | 1900 | |
43998163 | teitoku | E1 | Oct. 8, 2018, 12:28 p.m. | OK | PyPy 3 | TESTS | 51 | 343 | 23961600 | 1900 | |
40222153 | taiks | E1 | July 12, 2018, 7:02 a.m. | OK | Python 2 | TESTS | 51 | 608 | 47206400 | 1900 | |
53610649 | aleonov | E1 | May 1, 2019, 12:52 p.m. | OK | Python 3 | TESTS | 51 | 311 | 14643200 | 1900 | |
40264112 | Marii | E1 | July 13, 2018, 2:17 p.m. | OK | Python 3 | TESTS | 51 | 327 | 19353600 | 1900 | |
40930656 | ReaLNero1 | E1 | July 30, 2018, 12:05 a.m. | OK | Python 3 | TESTS | 51 | 358 | 19353600 | 1900 | |
64186817 | NocturneBflat | E1 | Nov. 4, 2019, 5:43 a.m. | OK | Python 3 | TESTS | 51 | 358 | 19456000 | 1900 | |
49350488 | vjudge1 | E1 | Feb. 2, 2019, 8:12 a.m. | OK | Python 3 | TESTS | 51 | 358 | 19558400 | 1900 | |
40700616 | gretel | E1 | July 24, 2018, 10:36 a.m. | OK | Python 3 | TESTS | 51 | 373 | 19660800 | 1900 | |
40217687 | kmyiu | E1 | July 12, 2018, 3:59 a.m. | OK | Python 3 | TESTS | 51 | 405 | 19353600 | 1900 | |
40237991 | dddl | E1 | July 12, 2018, 4:19 p.m. | OK | Python 3 | TESTS | 51 | 405 | 19660800 | 1900 | |
49992048 | AyakaMiyoshi | E1 | Feb. 16, 2019, 1:16 p.m. | OK | Python 3 | TESTS | 51 | 421 | 18227200 | 1900 | |
40249413 | orailly | E1 | July 13, 2018, 4:54 a.m. | OK | Python 3 | TESTS | 51 | 514 | 19660800 | 1900 | |
41546034 | betrue12 | E1 | Aug. 13, 2018, 5:03 a.m. | OK | Ruby | TESTS | 51 | 436 | 26419200 | 1900 | |
47492545 | yakamoto | E1 | Dec. 25, 2018, 1:04 p.m. | OK | Scala | TESTS | 51 | 654 | 16384000 | 1900 |
Back to search problems