Codeforces Round 636 (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
1343 Codeforces Round 636 (Div. 3) FINISHED False 7200 149873111 April 21, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 39197 ) C Alternating Subsequence PROGRAMMING dp greedy two pointers 1100

B'Recall that the sequence b is a a subsequence of the sequence a if b can be derived from a by removing zero or more elements without changing the order of the remaining elements. For example, if a=[1, 2, 1, 3, 1, 2, 1] , then possible subsequences are: [1, 1, 1, 1] , [3] and [1, 2, 1, 3, 1, 2, 1] , but not [3, 2, 3] and [1, 1, 1, 1, 2] . You are given a sequence a consisting of n positive and negative elements (there is no zeros in the sequence). Your task is to choose maximum by size (length) alternating subsequence of the given sequence (i.e. the sign of each next element is the opposite from the sign of the current element, like positive-negative-positive and so on or negative-positive-negative and so on). Among all such subsequences, you have to choose one which has the maximum sum of elements. In other words, if the maximum length of alternating subsequence is k then your task is to find the maximum sum of elements of some alternating subsequence of length k . You have to answer t independent test cases. The first line of the input contains one integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Then t test cases follow. The first line of the test case contains one integer n ( 1 <= n <= 2 cdot 10^5 ) -- the number of elements in a . The second line of the test case contains n integers a_1, a_2, ... , a_n ( -10^9 <= a_i <= 10^9, a_i ne 0 ), where a_i is the i -th element of a . It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 ( sum n <= 2 cdot 10^5 ). For each test case, print the answer -- the maximum sum of the maximum by size (length) alternating subsequence of a . In the first test case of the example, one of the possible answers is [1, 2, underline{3}, underline{-1}, -2] . In the second test case of the example, one of '...

Tutorials

76352

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
77641904 vjudge1 C April 22, 2020, 11:56 a.m. OK Clang++17 Diagnostics TESTS 103 171 0 1100
77601910 fpc_coder C April 22, 2020, 2:33 a.m. OK FPC TESTS 103 108 921600 1100
77715898 satyam_5123 C April 23, 2020, 5:46 a.m. OK GNU C11 TESTS 103 62 307200 1100
77567328 Zero_to_Zero C April 21, 2020, 4:34 p.m. OK GNU C11 TESTS 103 77 0 1100
77583634 rainboy C April 21, 2020, 7:06 p.m. OK GNU C11 TESTS 103 77 307200 1100
77570073 Trafalgar_D._Law C April 21, 2020, 4:45 p.m. OK GNU C11 TESTS 103 77 819200 1100
77562612 atillaqun C April 21, 2020, 4:27 p.m. OK GNU C11 TESTS 103 77 1843200 1100
77662951 _sam__ C April 22, 2020, 2:54 p.m. OK GNU C11 TESTS 103 78 0 1100
77617149 Tanzim_bn C April 22, 2020, 7:30 a.m. OK GNU C11 TESTS 103 78 0 1100
77664102 YcaptainY C April 22, 2020, 3:05 p.m. OK GNU C11 TESTS 103 78 0 1100
77584137 farabi685131 C April 21, 2020, 7:13 p.m. OK GNU C11 TESTS 103 78 819200 1100
77619313 Kelvin11 C April 22, 2020, 7:51 a.m. OK GNU C11 TESTS 103 78 1024000 1100
77917177 moursalinme C April 24, 2020, 1:44 p.m. OK GNU C++11 TESTS 103 31 307200 1100
77869360 licunchun2006 C April 24, 2020, 3:09 a.m. OK GNU C++11 TESTS 103 31 819200 1100
77996507 fangtanchen C April 25, 2020, 8:15 a.m. OK GNU C++11 TESTS 103 31 1638400 1100
77757385 emptyboxs C April 23, 2020, 1:28 p.m. OK GNU C++11 TESTS 103 31 1843200 1100
77601081 alicealicealice C April 22, 2020, 2:09 a.m. OK GNU C++11 TESTS 103 31 1843200 1100
77560329 zhuzhuqm C April 21, 2020, 4:23 p.m. OK GNU C++11 TESTS 103 31 1843200 1100
77992197 fangtanchen C April 25, 2020, 8:09 a.m. OK GNU C++11 TESTS 103 31 7987200 1100
77598030 Hpnes C April 22, 2020, 12:35 a.m. OK GNU C++11 TESTS 103 31 24268800 1100
77719929 Chubingtao C April 23, 2020, 6:42 a.m. OK GNU C++11 TESTS 103 31 32358400 1100
77763517 Zechel C April 23, 2020, 2:16 p.m. OK GNU C++11 TESTS 103 46 0 1100
77705718 fa_555 C April 23, 2020, 2:35 a.m. OK GNU C++14 TESTS 103 46 2150400 1100
77581360 tpriyanshu C April 21, 2020, 6:35 p.m. OK GNU C++14 TESTS 103 61 819200 1100
77586247 Wolf. C April 21, 2020, 7:45 p.m. OK GNU C++14 TESTS 103 61 819200 1100
77584497 unholyspirit C April 21, 2020, 7:18 p.m. OK GNU C++14 TESTS 103 61 1126400 1100
77558760 manraj1729 C April 21, 2020, 4:20 p.m. OK GNU C++14 TESTS 103 62 0 1100
77810562 vreaudelftpls C April 23, 2020, 3:38 p.m. OK GNU C++14 TESTS 103 62 819200 1100
77758972 prajwal_sonawane_IT_pict C April 23, 2020, 1:40 p.m. OK GNU C++14 TESTS 103 62 819200 1100
77723575 rutvik_zanz C April 23, 2020, 7:27 a.m. OK GNU C++14 TESTS 103 62 819200 1100
77697917 nasadigital C April 22, 2020, 9:59 p.m. OK GNU C++14 TESTS 103 62 819200 1100
78011887 yashgandhijee900 C April 25, 2020, 10:14 a.m. OK GNU C++14 TESTS 103 62 819200 1100
77598221 _andyli C April 22, 2020, 12:42 a.m. OK GNU C++17 TESTS 103 31 4198400 1100
77564301 Arif042 C April 21, 2020, 4:30 p.m. OK GNU C++17 TESTS 103 46 819200 1100
77558443 TINY_OUNCE911666 C April 21, 2020, 4:20 p.m. OK GNU C++17 TESTS 103 46 1638400 1100
77978222 potoooooooo C April 25, 2020, 5:28 a.m. OK GNU C++17 TESTS 103 61 1638400 1100
77676361 dkar C April 22, 2020, 4:57 p.m. OK GNU C++17 TESTS 103 62 0 1100
77681346 Ghozlan C April 22, 2020, 5:49 p.m. OK GNU C++17 TESTS 103 62 0 1100
77618179 kk12138 C April 22, 2020, 7:40 a.m. OK GNU C++17 TESTS 103 62 0 1100
77623488 accwxhn C April 22, 2020, 8:35 a.m. OK GNU C++17 TESTS 103 62 0 1100
77656280 unused C April 22, 2020, 1:53 p.m. OK GNU C++17 TESTS 103 62 0 1100
77657405 JeryDeak C April 22, 2020, 2:04 p.m. OK GNU C++17 TESTS 103 62 0 1100
77676825 hltk C April 22, 2020, 5:01 p.m. OK GNU C++17 (64) TESTS 103 46 0 1100
77931858 ivan100sic C April 24, 2020, 3:47 p.m. OK GNU C++17 (64) TESTS 103 46 0 1100
77675359 hltk C April 22, 2020, 4:47 p.m. OK GNU C++17 (64) TESTS 103 46 0 1100
77620835 nathanlee726 C April 22, 2020, 8:07 a.m. OK GNU C++17 (64) TESTS 103 46 0 1100
77560665 Vasyl_Protsiv C April 21, 2020, 4:24 p.m. OK GNU C++17 (64) TESTS 103 46 819200 1100
77585484 RitikBaid C April 21, 2020, 7:33 p.m. OK GNU C++17 (64) TESTS 103 46 819200 1100
77594892 Ormlis C April 21, 2020, 10:46 p.m. OK GNU C++17 (64) TESTS 103 46 819200 1100
77598920 Slamur C April 22, 2020, 1:04 a.m. OK GNU C++17 (64) TESTS 103 46 819200 1100
77629391 bluestorm57 C April 22, 2020, 9:43 a.m. OK GNU C++17 (64) TESTS 103 46 819200 1100
77723596 naveenk2k C April 23, 2020, 7:27 a.m. OK GNU C++17 (64) TESTS 103 46 819200 1100
77557928 3345281866 C April 21, 2020, 4:18 p.m. OK Go TESTS 103 124 102400 1100
77601140 amarjeetanand C April 22, 2020, 2:11 a.m. OK Go TESTS 103 124 4505600 1100
77637994 sighduck C April 22, 2020, 11:16 a.m. OK Go TESTS 103 171 5324800 1100
77601175 XOR-star C April 22, 2020, 2:12 a.m. OK Haskell TESTS 103 779 54681600 1100
77618204 kgcode C April 22, 2020, 7:40 a.m. OK Java 11 TESTS 103 202 0 1100
77618037 yb1717 C April 22, 2020, 7:39 a.m. OK Java 11 TESTS 103 218 0 1100
77699248 TheSawan C April 22, 2020, 10:40 p.m. OK Java 11 TESTS 103 218 3174400 1100
77674243 mikkk C April 22, 2020, 4:36 p.m. OK Java 11 TESTS 103 218 3174400 1100
77651991 Piccadilly C April 22, 2020, 1:26 p.m. OK Java 11 TESTS 103 218 3174400 1100
77588556 ddhroov10 C April 21, 2020, 8:23 p.m. OK Java 11 TESTS 103 218 3174400 1100
77620466 soumitri12 C April 22, 2020, 8:03 a.m. OK Java 11 TESTS 103 218 6144000 1100
77586464 soumitri12 C April 21, 2020, 7:49 p.m. OK Java 11 TESTS 103 233 3174400 1100
77609613 saurabh0611 C April 22, 2020, 5:34 a.m. OK Java 11 TESTS 103 234 0 1100
77707134 rajparekh2024 C April 23, 2020, 3:16 a.m. OK Java 11 TESTS 103 248 0 1100
77858575 bluesky111 C April 23, 2020, 10:24 p.m. OK Java 8 TESTS 103 124 0 1100
77974746 top_gun16 C April 25, 2020, 4:34 a.m. OK Java 8 TESTS 103 124 0 1100
77973229 dyhu083 C April 25, 2020, 4:08 a.m. OK Java 8 TESTS 103 124 0 1100
77678365 ishantewari92 C April 22, 2020, 5:17 p.m. OK Java 8 TESTS 103 124 0 1100
77605392 Manan8686 C April 22, 2020, 4:02 a.m. OK Java 8 TESTS 103 124 0 1100
77584781 NMouad21 C April 21, 2020, 7:22 p.m. OK Java 8 TESTS 103 124 0 1100
77582576 kashishsingh8700 C April 21, 2020, 6:51 p.m. OK Java 8 TESTS 103 124 0 1100
77579015 Ziklon C April 21, 2020, 6:06 p.m. OK Java 8 TESTS 103 124 0 1100
77573979 saikaushik333 C April 21, 2020, 5:14 p.m. OK Java 8 TESTS 103 124 0 1100
77571236 amolpratap007 C April 21, 2020, 4:52 p.m. OK Java 8 TESTS 103 124 0 1100
77658236 arpit2438735 C April 22, 2020, 2:11 p.m. OK JavaScript TESTS 103 155 32563200 1100
77604066 Spheniscine C April 22, 2020, 3:32 a.m. OK Kotlin TESTS 103 171 13312000 1100
77703505 IsTinG C April 23, 2020, 1:19 a.m. OK Kotlin TESTS 103 405 17203200 1100
77620395 dkozak94 C April 22, 2020, 8:02 a.m. OK Kotlin TESTS 103 405 20070400 1100
77882932 Chef_17 C April 24, 2020, 6:26 a.m. OK Kotlin TESTS 103 436 17203200 1100
77594101 PPons C April 21, 2020, 10:24 p.m. OK Mono C# TESTS 103 140 28979200 1100
77650073 TRR C April 22, 2020, 1:20 p.m. OK Mono C# TESTS 103 156 26624000 1100
77695549 zerg C April 22, 2020, 9:03 p.m. OK Mono C# TESTS 103 186 14950400 1100
77869373 HenrySo0127 C April 24, 2020, 3:09 a.m. OK Mono C# TESTS 103 576 28569600 1100
77601545 KenMai C April 22, 2020, 2:22 a.m. OK MS C++ TESTS 103 46 0 1100
77601576 KenMai C April 22, 2020, 2:23 a.m. OK MS C++ TESTS 103 46 0 1100
77557251 LolLoDaffy C April 21, 2020, 4:17 p.m. OK MS C++ TESTS 103 202 0 1100
77558369 phoenicyan C April 21, 2020, 4:19 p.m. OK MS C++ TESTS 103 218 0 1100
77563647 bqns0125 C April 21, 2020, 4:29 p.m. OK MS C++ TESTS 103 389 819200 1100
77910608 vjudge2 C April 24, 2020, 12:24 p.m. OK MS C++ 2017 TESTS 103 78 0 1100
77982886 x_y C April 25, 2020, 6:25 a.m. OK MS C++ 2017 TESTS 103 93 0 1100
77660984 elvcn C April 22, 2020, 2:36 p.m. OK MS C++ 2017 TESTS 103 93 0 1100
77620456 Bigface C April 22, 2020, 8:03 a.m. OK MS C++ 2017 TESTS 103 93 7987200 1100
77652273 DmitryZ C April 22, 2020, 1:28 p.m. OK MS C++ 2017 TESTS 103 187 0 1100
77569677 AquilaXP C April 21, 2020, 4:43 p.m. OK MS C++ 2017 TESTS 103 202 0 1100
77582715 minionsnow C April 21, 2020, 6:53 p.m. OK MS C++ 2017 TESTS 103 202 819200 1100
77680713 Falca C April 22, 2020, 5:42 p.m. OK MS C++ 2017 TESTS 103 202 819200 1100
77557256 LeeJongHun C April 21, 2020, 4:17 p.m. OK MS C++ 2017 TESTS 103 202 1638400 1100
77761911 jdyj C April 23, 2020, 2:05 p.m. OK MS C++ 2017 TESTS 103 202 1638400 1100
77761277 v3d3 C April 23, 2020, 1:59 p.m. OK Node.js TESTS 103 296 26624000 1100
77584711 olga-rmrf C April 21, 2020, 7:21 p.m. OK Node.js TESTS 103 358 26726400 1100
77591685 olga-rmrf C April 21, 2020, 9:21 p.m. OK Node.js TESTS 103 374 26726400 1100
77570313 holden_caulfield C April 21, 2020, 4:47 p.m. OK PHP TESTS 103 109 20582400 1100
77629609 mayakin C April 22, 2020, 9:45 a.m. OK PHP TESTS 103 124 20582400 1100
77590834 yumtam C April 21, 2020, 9:04 p.m. OK PyPy 2 TESTS 103 171 14233600 1100
77690067 lebron87 C April 22, 2020, 7:32 p.m. OK PyPy 2 TESTS 103 405 11673600 1100
77689532 lebron87 C April 22, 2020, 7:24 p.m. OK PyPy 2 TESTS 103 405 18636800 1100
77662914 LaoJiangHu C April 22, 2020, 2:54 p.m. OK PyPy 2 TESTS 103 420 13004800 1100
77673738 LaoJiangHu C April 22, 2020, 4:31 p.m. OK PyPy 2 TESTS 103 436 17612800 1100
77589994 bazzyadb C April 21, 2020, 8:48 p.m. OK PyPy 2 TESTS 103 607 13312000 1100
77670444 PavelJunior C April 22, 2020, 4:01 p.m. OK PyPy 3 TESTS 103 202 16793600 1100
77627474 Aestroix C April 22, 2020, 9:20 a.m. OK PyPy 3 TESTS 103 202 19148800 1100
77648649 akshaysolanki941 C April 22, 2020, 1:05 p.m. OK PyPy 3 TESTS 103 217 19865600 1100
77680726 negisachin688 C April 22, 2020, 5:42 p.m. OK PyPy 3 TESTS 103 218 20172800 1100
77692783 robert_nabil20022002 C April 22, 2020, 8:14 p.m. OK PyPy 3 TESTS 103 233 20275200 1100
77606487 siyy C April 22, 2020, 4:26 a.m. OK PyPy 3 TESTS 103 249 21401600 1100
77622010 robert_nabil20022002 C April 22, 2020, 8:19 a.m. OK PyPy 3 TESTS 103 264 20275200 1100
77672028 sadikulsadi1500 C April 22, 2020, 4:15 p.m. OK PyPy 3 TESTS 103 342 17715200 1100
77730645 roaris C April 23, 2020, 8:56 a.m. OK PyPy 3 TESTS 103 342 20377600 1100
77627968 Anuranjan_Pandey C April 22, 2020, 9:26 a.m. OK PyPy 3 TESTS 103 343 17920000 1100
77646083 ComptineDunAutreEte C April 22, 2020, 12:39 p.m. OK Python 2 TESTS 103 389 11161600 1100
77924281 khoatran_viet C April 24, 2020, 2:43 p.m. OK Python 2 TESTS 103 405 11161600 1100
77563955 elistark C April 21, 2020, 4:29 p.m. OK Python 2 TESTS 103 420 11059200 1100
77592401 xlax007 C April 21, 2020, 9:37 p.m. OK Python 3 TESTS 103 218 16793600 1100
77568321 eugalt C April 21, 2020, 4:37 p.m. OK Python 3 TESTS 103 233 14540800 1100
77645821 c_r_5 C April 22, 2020, 12:36 p.m. OK Python 3 TESTS 103 249 14540800 1100
77568667 eugalt C April 21, 2020, 4:38 p.m. OK Python 3 TESTS 103 249 14540800 1100
77585343 gravi7111999 C April 21, 2020, 7:31 p.m. OK Python 3 TESTS 103 249 16691200 1100
77854993 SergiiKo C April 23, 2020, 9:18 p.m. OK Python 3 TESTS 103 264 16793600 1100
77606401 eugalt C April 22, 2020, 4:24 a.m. OK Python 3 TESTS 103 265 14438400 1100
77688345 nicolasinott C April 22, 2020, 7:08 p.m. OK Python 3 TESTS 103 280 14131200 1100
77663170 naveen_27 C April 22, 2020, 2:56 p.m. OK Python 3 TESTS 103 280 16384000 1100
77623127 JHTNT C April 22, 2020, 8:31 a.m. OK Python 3 TESTS 103 280 16691200 1100
77575199 mine515 C April 21, 2020, 5:25 p.m. OK Ruby TESTS 103 405 34918400 1100
77655443 xyqkoala C April 22, 2020, 1:45 p.m. OK Rust TESTS 103 46 6246400 1100

remove filters

Back to search problems