Codeforces Round 496 (Div. 3)

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.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1326 ) E2 Median on Segments (General Case Edition) PROGRAMMING sortings 2600

B'You are given an integer sequence a_1, a_2, ... , a_n . Find the number of pairs of indices (l, r) ( 1 <= l <= r <= n ) such that the value of median of a_l, a_{l+1}, ... , a_r is exactly the given number m . The median of a sequence is the value of an 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 median of a_l, a_{l+1}, ... , a_r is exactly the given number m . The first line contains integers n and m ( 1 <= n,m <= 2 cdot10^5 ) -- the length of the given sequence and the required value of the median. The second line contains an integer sequence a_1, a_2, ... , a_n ( 1 <= a_i <= 2 cdot10^5 ). Print the required number. In the first example, the suitable pairs of indices are: (1, 3) , (1, 4) , (1, 5) , (2, 2) , (2, 3) , (2, 5) , (4, 5) and (5, 5) . '...

Tutorials

Codeforces Round 496 (Div. 3): Problem Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
41000684 vjudge1 E2 July 31, 2018, 6:58 a.m. OK Clang++17 Diagnostics TESTS 64 124 8806400 2600
40223444 Dis_19260817 E2 July 12, 2018, 7:40 a.m. OK GNU C++ TESTS 64 46 2457600 2600
40782783 zhtzht E2 July 26, 2018, 2:49 p.m. OK GNU C++ TESTS 64 46 3276800 2600
41127389 Scut82 E2 Aug. 2, 2018, 2:56 p.m. OK GNU C++ TESTS 64 46 6451200 2600
40722365 vjudge4 E2 July 25, 2018, 2:11 a.m. OK GNU C++ TESTS 64 46 7270400 2600
40201327 cxb6yhf E2 July 11, 2018, 12:47 p.m. OK GNU C++ TESTS 64 61 3174400 2600
40258220 Ccccccccccc E2 July 13, 2018, 10:33 a.m. OK GNU C++ TESTS 64 61 3584000 2600
40187821 shijk E2 July 11, 2018, 3:36 a.m. OK GNU C++ TESTS 64 61 3993600 2600
41111834 vjudge1 E2 Aug. 2, 2018, 7:09 a.m. OK GNU C++ TESTS 64 61 16384000 2600
40993755 vjudge4 E2 July 31, 2018, 2:12 a.m. OK GNU C++ TESTS 64 62 2252800 2600
40933105 vjudge2 E2 July 30, 2018, 2:19 a.m. OK GNU C++ TESTS 64 62 2252800 2600
66526750 luogu_bot1 E2 Dec. 9, 2019, 5:22 a.m. OK GNU C++11 TESTS 64 31 2457600 2600
66526735 MoQianXue E2 Dec. 9, 2019, 5:21 a.m. OK GNU C++11 TESTS 64 31 2457600 2600
54071957 sunny_fei E2 May 13, 2019, 4:50 p.m. OK GNU C++11 TESTS 64 31 2457600 2600
40202897 elijahqi E2 July 11, 2018, 1:40 p.m. OK GNU C++11 TESTS 64 46 2457600 2600
40304019 maximumhanyu E2 July 14, 2018, 4:30 a.m. OK GNU C++11 TESTS 64 46 3174400 2600
40394296 HolyK E2 July 16, 2018, 3:47 a.m. OK GNU C++11 TESTS 64 46 3276800 2600
64285159 ddytxdy E2 Nov. 5, 2019, 4:26 a.m. OK GNU C++11 TESTS 64 61 2457600 2600
40170836 strawberrry E2 July 10, 2018, 12:21 p.m. OK GNU C++11 TESTS 64 61 2457600 2600
40258891 small_doubt E2 July 13, 2018, 11:02 a.m. OK GNU C++11 TESTS 64 61 7987200 2600
53308701 vjudge3 E2 April 26, 2019, 4:53 a.m. OK GNU C++11 TESTS 64 61 8089600 2600
45787244 wleung_bvg E2 Nov. 16, 2018, 3:18 a.m. OK GNU C++14 TESTS 64 46 2457600 2600
40188784 deserteagle735 E2 July 11, 2018, 4:46 a.m. OK GNU C++14 TESTS 64 62 2355200 2600
40311961 yaojiayoua E2 July 14, 2018, 8:27 a.m. OK GNU C++14 TESTS 64 62 2457600 2600
40301522 wangshu E2 July 14, 2018, 2:29 a.m. OK GNU C++14 TESTS 64 62 2457600 2600
40177289 anis028 E2 July 10, 2018, 4:01 p.m. OK GNU C++14 TESTS 64 62 2457600 2600
49309748 zhaoy1ping E2 Feb. 1, 2019, 7:18 a.m. OK GNU C++14 TESTS 64 62 2662400 2600
40194529 5120160705 E2 July 11, 2018, 8:26 a.m. OK GNU C++14 TESTS 64 62 2662400 2600
47892939 nwei E2 Jan. 4, 2019, 8:10 a.m. OK GNU C++14 TESTS 64 62 3276800 2600
40186916 jackyan E2 July 11, 2018, 2:32 a.m. OK GNU C++14 TESTS 64 77 2355200 2600
63106194 aviroop123 E2 Oct. 22, 2019, 4:54 a.m. OK GNU C++14 TESTS 64 77 2457600 2600
68633451 vjudge5 E2 Jan. 12, 2020, 4:32 a.m. OK GNU C++17 TESTS 64 62 2457600 2600
55279581 oskarfiuk1 E2 June 7, 2019, 10:44 p.m. OK GNU C++17 TESTS 64 62 2457600 2600
40891926 vjudge1 E2 July 28, 2018, 4:37 p.m. OK GNU C++17 TESTS 64 62 2457600 2600
40224158 Wei.Jin E2 July 12, 2018, 8:03 a.m. OK GNU C++17 TESTS 64 62 3174400 2600
44467552 endereye E2 Oct. 18, 2018, 3:50 a.m. OK GNU C++17 TESTS 64 77 2355200 2600
68636716 h404nofound E2 Jan. 12, 2020, 6:06 a.m. OK GNU C++17 TESTS 64 77 2457600 2600
61408376 hjk1030 E2 Sept. 28, 2019, 7:47 a.m. OK GNU C++17 TESTS 64 77 2457600 2600
40399623 chen_yongzu E2 July 16, 2018, 7:02 a.m. OK GNU C++17 TESTS 64 77 2457600 2600
40234381 DomiKo E2 July 12, 2018, 1:54 p.m. OK GNU C++17 TESTS 64 77 2457600 2600
40232935 614984177 E2 July 12, 2018, 1:05 p.m. OK GNU C++17 TESTS 64 77 2457600 2600
55985263 caoash E2 June 24, 2019, 2:43 a.m. OK Java 8 TESTS 64 139 0 2600
40298444 out_of_the_box E2 July 13, 2018, 10:59 p.m. OK Java 8 TESTS 64 140 0 2600
40234127 In_The_Name_Of_Love E2 July 12, 2018, 1:47 p.m. OK Java 8 TESTS 64 140 0 2600
40221885 uwi E2 July 12, 2018, 6:54 a.m. OK Java 8 TESTS 64 140 0 2600
40170490 tusharjape007 E2 July 10, 2018, 12:12 p.m. OK Java 8 TESTS 64 140 0 2600
40222025 uwi E2 July 12, 2018, 6:58 a.m. OK Java 8 TESTS 64 171 0 2600
63721825 yaoct E2 Oct. 29, 2019, 11:35 a.m. OK Java 8 TESTS 64 171 2867200 2600
46167150 hongquanntct E2 Nov. 24, 2018, 10:48 a.m. OK Java 8 TESTS 64 171 3584000 2600
40242610 scoobydoo E2 July 12, 2018, 8:13 p.m. OK Java 8 TESTS 64 187 2867200 2600
41958225 BaZ_ E2 Aug. 22, 2018, 7:56 a.m. OK Java 8 TESTS 64 249 6246400 2600
40572616 apologize12138 E2 July 20, 2018, 8:58 a.m. OK MS C++ TESTS 64 62 2457600 2600
40652210 CrashMaster E2 July 23, 2018, 12:11 a.m. OK MS C++ TESTS 64 156 2457600 2600
63078593 yorky E2 Oct. 21, 2019, 2:25 p.m. OK MS C++ 2017 TESTS 64 202 7987200 2600
42220479 LordVader E2 Aug. 28, 2018, 8:07 p.m. OK PyPy 3 TESTS 64 280 18124800 2600
63034345 Zombie358 E2 Oct. 20, 2019, 7:57 p.m. OK PyPy 3 TESTS 64 326 20889600 2600
59699190 yfo E2 Aug. 30, 2019, 9:53 a.m. OK PyPy 3 TESTS 64 374 25497600 2600
40211570 Ali_Pi E2 July 11, 2018, 8:23 p.m. OK Python 2 TESTS 64 514 15052800 2600
53610611 aleonov E2 May 1, 2019, 12:50 p.m. OK Python 3 TESTS 64 327 14643200 2600
40250323 orailly E2 July 13, 2018, 5:41 a.m. OK Python 3 TESTS 64 390 14336000 2600
49999004 AyakaMiyoshi E2 Feb. 16, 2019, 4:28 p.m. OK Python 3 TESTS 64 404 19558400 2600
40321727 bert30702 E2 July 14, 2018, 2:34 p.m. OK Python 3 TESTS 64 421 14233600 2600
40321625 bert30702 E2 July 14, 2018, 2:28 p.m. OK Python 3 TESTS 64 421 14233600 2600
40930655 ReaLNero1 E2 July 30, 2018, 12:04 a.m. OK Python 3 TESTS 64 436 14233600 2600
40264104 dddl E2 July 13, 2018, 2:17 p.m. OK Python 3 TESTS 64 436 19353600 2600
40465875 xh286286 E2 July 17, 2018, 6:45 a.m. OK Python 3 TESTS 64 499 14848000 2600
41548468 betrue12 E2 Aug. 13, 2018, 6:52 a.m. OK Ruby TESTS 64 421 44339200 2600

remove filters

Back to search problems