Codeforces Round 918 (Div. 4)

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
1915 Codeforces Round 918 (Div. 4) FINISHED False 9000 28049099 Dec. 28, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 22228 ) E Romantic Glasses PROGRAMMING data structures greedy math

B'Iulia has n glasses arranged in a line. The i -th glass has a_i units of juice in it. Iulia drinks only from odd-numbered glasses, while her date drinks only from even-numbered glasses. To impress her date, Iulia wants to find a contiguous subarray of these glasses such that both Iulia and her date will have the same amount of juice in total if only the glasses in this subarray are considered. Please help her to do that. More formally, find out if there exists two indices l , r such that 1 <= q l <= q r <= q n , and a_l + a_{l + 2} + a_{l + 4} + ... + a_{r} = a_{l + 1} + a_{l + 3} + ... + a_{r-1} if l and r have the same parity and a_l + a_{l + 2} + a_{l + 4} + ... + a_{r - 1} = a_{l + 1} + a_{l + 3} + ... + a_{r} otherwise. The first line contains a single integer t ( 1 <= q t <= q 10^4 ) -- the number of test cases. The first line of each test case contains a single integer n ( 1 <= q n <= q 2 cdot 10^5 ) -- the total number of glasses. The second line of each test case contains n integers a_1, ldots, a_n ( 1 <= q a_i <= q 10^9 ) -- the amount of juice in each glass. The sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output "YES" if there exists a subarray satisfying the condition, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). In the first test case, Iulia can pick l=1 and r=3 . Then she drinks a_1+a_3=1+2=3 units and her date drinks a_2=3 units of juice. In the second test case, Iulia can pick l=2 and r=5 . Then she drinks a_3+a_5=1+1=2 units and her date drinks a_2+a_4=1+1=2 units of juice. In the third test case no such contiguous subarray works. In the fourth test case, Iulia can pick l=2 and r=8 . Then she drinks a_3+a_5+a_7=11+1+1='...

Tutorials

123952

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
239445834 bluemegane E Dec. 29, 2023, 5:18 a.m. OK C# 8 TESTS 36 187 40652800
239422382 NenadDapic E Dec. 28, 2023, 9:08 p.m. OK FPC TESTS 31 93 5120000
239403102 0x81 E Dec. 28, 2023, 5:33 p.m. OK GNU C11 TESTS 10 78 5529600
239413348 Mayankdal E Dec. 28, 2023, 7 p.m. OK GNU C++14 TESTS 10 77 7475200
239436099 codeFarmer. E Dec. 29, 2023, 3 a.m. OK GNU C++14 TESTS 36 93 3481600
239423297 ktp200 E Dec. 28, 2023, 9:26 p.m. OK GNU C++14 TESTS 31 93 4300800
239423423 ktp200 E Dec. 28, 2023, 9:29 p.m. OK GNU C++14 TESTS 31 93 4300800
239406574 manishkumar123 E Dec. 28, 2023, 5:59 p.m. OK GNU C++14 TESTS 10 93 8908800
239413826 Quarter_Master E Dec. 28, 2023, 7:05 p.m. OK GNU C++14 TESTS 10 93 8908800
239407838 Omar_Farhat E Dec. 28, 2023, 6:09 p.m. OK GNU C++14 TESTS 10 93 9728000
239432446 trieuvimely E Dec. 29, 2023, 1:37 a.m. OK GNU C++14 TESTS 36 93 10035200
239414096 elexmite1 E Dec. 28, 2023, 7:09 p.m. OK GNU C++14 TESTS 10 93 10240000
239414289 CoolFull E Dec. 28, 2023, 7:11 p.m. OK GNU C++14 TESTS 10 93 10547200
239427946 vjudge4 E Dec. 28, 2023, 11:17 p.m. OK GNU C++17 TESTS 31 62 5836800
239406601 NEUQorW E Dec. 28, 2023, 5:59 p.m. OK GNU C++17 TESTS 10 77 2662400
239413881 Kiavash1387 E Dec. 28, 2023, 7:06 p.m. OK GNU C++17 TESTS 10 77 5836800
239406121 sinataghizadeh E Dec. 28, 2023, 5:56 p.m. OK GNU C++17 TESTS 10 78 4300800
239414384 DriveLilah E Dec. 28, 2023, 7:12 p.m. OK GNU C++17 TESTS 10 78 4300800
239439259 Hehe. E Dec. 29, 2023, 3:54 a.m. OK GNU C++17 TESTS 36 78 4403200
239403470 fengyss E Dec. 28, 2023, 5:35 p.m. OK GNU C++17 TESTS 10 78 9932800
239403712 nasimnoob E Dec. 28, 2023, 5:37 p.m. OK GNU C++17 TESTS 10 78 10035200
239405234 shishir119 E Dec. 28, 2023, 5:49 p.m. OK GNU C++17 TESTS 10 78 10035200
239430876 Liang2003 E Dec. 29, 2023, 12:52 a.m. OK GNU C++17 TESTS 36 78 17100800
239420674 ganeid E Dec. 28, 2023, 8:38 p.m. OK GNU C++17 (64) TESTS 10 46 14233600
239440133 watcherrr E Dec. 29, 2023, 4:06 a.m. OK GNU C++17 (64) TESTS 36 61 3686400
239433047 jack_Y E Dec. 29, 2023, 1:51 a.m. OK GNU C++17 (64) TESTS 36 62 3686400
239428253 enslaved E Dec. 28, 2023, 11:27 p.m. OK GNU C++17 (64) TESTS 31 62 3686400
239414331 ganeid E Dec. 28, 2023, 7:11 p.m. OK GNU C++17 (64) TESTS 10 77 14131200
239439858 squirrel_sys E Dec. 29, 2023, 4:02 a.m. OK GNU C++17 (64) TESTS 36 78 10956800
239411692 Warrior_1729 E Dec. 28, 2023, 6:42 p.m. OK GNU C++17 (64) TESTS 10 78 12492800
239431417 Ethanyuan E Dec. 29, 2023, 1:07 a.m. OK GNU C++17 (64) TESTS 36 78 17305600
239439083 ZiFeii E Dec. 29, 2023, 3:51 a.m. OK GNU C++17 (64) TESTS 36 93 10956800
239421628 urvashi_1210 E Dec. 28, 2023, 8:54 p.m. OK GNU C++17 (64) TESTS 10 93 12083200
239404264 loutre E Dec. 28, 2023, 5:41 p.m. OK GNU C++20 (64) TESTS 10 31 4505600
239422757 A7med_Nageh E Dec. 28, 2023, 9:16 p.m. OK GNU C++20 (64) TESTS 31 46 2867200
239417272 sijan E Dec. 28, 2023, 7:48 p.m. OK GNU C++20 (64) TESTS 10 46 2867200
239408184 _rhythm_07_ E Dec. 28, 2023, 6:11 p.m. OK GNU C++20 (64) TESTS 10 46 2867200
239406749 NEUQorW E Dec. 28, 2023, 6:01 p.m. OK GNU C++20 (64) TESTS 10 46 2867200
239408715 keyur1284 E Dec. 28, 2023, 6:15 p.m. OK GNU C++20 (64) TESTS 10 46 2867200
239441668 nayonmondol18 E Dec. 29, 2023, 4:27 a.m. OK GNU C++20 (64) TESTS 36 46 2867200
239423042 AvidAshu E Dec. 28, 2023, 9:21 p.m. OK GNU C++20 (64) TESTS 31 46 2867200
239439896 yindudafeizhu E Dec. 29, 2023, 4:03 a.m. OK GNU C++20 (64) TESTS 36 46 4505600
239445812 dongfangyanxu E Dec. 29, 2023, 5:18 a.m. OK GNU C++20 (64) TESTS 36 46 4505600
239449404 ajayg3059 E Dec. 29, 2023, 5:57 a.m. OK Go TESTS 36 124 30617600
239437710 123_wby E Dec. 29, 2023, 3:30 a.m. OK Go TESTS 36 139 36249600
239417780 venkateshaprabhu E Dec. 28, 2023, 7:55 p.m. OK Java 11 TESTS 10 295 138444800
239412017 shaili17 E Dec. 28, 2023, 6:46 p.m. OK Java 11 TESTS 10 327 46592000
239406721 FirstException E Dec. 28, 2023, 6 p.m. OK Java 11 TESTS 10 358 110796800
239412999 mohit038 E Dec. 28, 2023, 6:56 p.m. OK Java 11 TESTS 10 514 41881600
239403506 PlayDate E Dec. 28, 2023, 5:35 p.m. OK Java 11 TESTS 10 545 30924800
239442950 rajneesh.osho E Dec. 29, 2023, 4:43 a.m. OK Java 11 TESTS 36 577 39731200
239408928 snowyrsb E Dec. 28, 2023, 6:17 p.m. OK Java 17 TESTS 10 373 53145600
239437888 AKhacks E Dec. 29, 2023, 3:33 a.m. OK Java 17 TESTS 36 405 59801600
239436356 ktcat E Dec. 29, 2023, 3:05 a.m. OK Java 17 TESTS 36 421 63795200
239434944 dilshar23 E Dec. 29, 2023, 2:39 a.m. OK Java 17 TESTS 36 421 64102400
239403433 Jha_coder1942 E Dec. 28, 2023, 5:35 p.m. OK Java 17 TESTS 10 623 56729600
239446292 krish1832 E Dec. 29, 2023, 5:23 a.m. OK Java 17 TESTS 36 623 59392000
239405383 Ronak_Thesiya E Dec. 28, 2023, 5:50 p.m. OK Java 17 TESTS 10 624 55500800
239408809 Ashuraj_Herode E Dec. 28, 2023, 6:16 p.m. OK Java 17 TESTS 10 639 67276800
239449828 skylord69 E Dec. 29, 2023, 6:01 a.m. OK Java 17 TESTS 36 686 59392000
239413718 A_R_I_F E Dec. 28, 2023, 7:04 p.m. OK Java 17 TESTS 10 779 53760000
239424405 mangos194 E Dec. 28, 2023, 9:48 p.m. OK Java 21 TESTS 31 327 46694400
239417787 sarthakmanna E Dec. 28, 2023, 7:56 p.m. OK Java 21 TESTS 10 342 56012800
239406819 Manas421321 E Dec. 28, 2023, 6:01 p.m. OK Java 21 TESTS 10 343 57241600
239404730 Manas421321 E Dec. 28, 2023, 5:44 p.m. OK Java 21 TESTS 10 405 64921600
239437836 CV23 E Dec. 29, 2023, 3:32 a.m. OK Java 21 TESTS 36 467 73932800
239427011 newborn_23 E Dec. 28, 2023, 10:51 p.m. OK Java 21 TESTS 31 483 65536000
239444796 rajatpro2206 E Dec. 29, 2023, 5:06 a.m. OK Java 21 TESTS 36 483 66560000
239419610 _vardan_ E Dec. 28, 2023, 8:21 p.m. OK Java 21 TESTS 10 701 57344000
239407456 kundankumardec16 E Dec. 28, 2023, 6:07 p.m. OK Java 21 TESTS 10 701 58470400
239413729 mk6748134 E Dec. 28, 2023, 7:04 p.m. OK Java 21 TESTS 10 701 58675200
239409597 raj_shahh E Dec. 28, 2023, 6:23 p.m. OK Java 8 TESTS 10 217 35532800
239409341 vinay_panwar E Dec. 28, 2023, 6:21 p.m. OK Java 8 TESTS 10 234 34201600
239447132 prakhar_30 E Dec. 29, 2023, 5:33 a.m. OK Java 8 TESTS 36 249 35430400
239447269 1091857051 E Dec. 29, 2023, 5:35 a.m. OK Java 8 TESTS 36 264 37376000
239433091 ChongQY E Dec. 29, 2023, 1:52 a.m. OK Java 8 TESTS 36 311 39526400
239422576 NerfThis E Dec. 28, 2023, 9:12 p.m. OK Java 8 TESTS 31 373 47001600
239425800 reactioner E Dec. 28, 2023, 10:19 p.m. OK Java 8 TESTS 31 467 32972800
239440528 amit_roy E Dec. 29, 2023, 4:11 a.m. OK Java 8 TESTS 36 514 36352000
239445274 gauravpatel22 E Dec. 29, 2023, 5:11 a.m. OK Java 8 TESTS 36 577 36352000
239418337 YouKnowWhoIAm E Dec. 28, 2023, 8:03 p.m. OK Java 8 TESTS 10 670 32460800
239405704 PixelCat E Dec. 28, 2023, 5:52 p.m. OK Kotlin 1.9 TESTS 10 904 229478400
239406069 PixelCat E Dec. 28, 2023, 5:55 p.m. OK Kotlin 1.9 TESTS 10 936 231014400
239407042 Ganbaruzoi E Dec. 28, 2023, 6:03 p.m. OK MS C++ 2017 TESTS 10 218 4300800
239412965 Badranium E Dec. 28, 2023, 6:55 p.m. OK MS C++ 2017 TESTS 10 234 8908800
239430584 maikh07 E Dec. 29, 2023, 12:43 a.m. OK MS C++ 2017 TESTS 36 249 8089600
239430603 maikh07 E Dec. 29, 2023, 12:43 a.m. OK MS C++ 2017 TESTS 36 280 7577600
239421775 sardorboboshov E Dec. 28, 2023, 8:57 p.m. OK Node.js TESTS 10 155 69017600
239436657 katomasao E Dec. 29, 2023, 3:10 a.m. OK Perl TESTS 36 311 44032000
239435153 katomasao E Dec. 29, 2023, 2:43 a.m. OK Perl TESTS 36 358 43008000
239412109 Sovi_11 E Dec. 28, 2023, 6:46 p.m. OK PyPy 3 TESTS 10 373 46387200
239447209 tan36 E Dec. 29, 2023, 5:34 a.m. OK PyPy 3 TESTS 36 499 47616000
239415029 AndreiZherder E Dec. 28, 2023, 7:20 p.m. OK PyPy 3-64 TESTS 10 124 55603200
239421203 daszybak E Dec. 28, 2023, 8:46 p.m. OK PyPy 3-64 TESTS 10 140 59494400
239418537 Litz E Dec. 28, 2023, 8:05 p.m. OK PyPy 3-64 TESTS 10 140 60211200
239404754 Mohamed_Hamed E Dec. 28, 2023, 5:45 p.m. OK PyPy 3-64 TESTS 10 155 58777600
239447544 wlgh7407 E Dec. 29, 2023, 5:38 a.m. OK PyPy 3-64 TESTS 36 155 60313600
239419928 DRDIV E Dec. 28, 2023, 8:26 p.m. OK PyPy 3-64 TESTS 10 155 61644800
239408821 Tobzhan E Dec. 28, 2023, 6:16 p.m. OK PyPy 3-64 TESTS 10 156 61132800
239407366 a-rn-va27 E Dec. 28, 2023, 6:06 p.m. OK PyPy 3-64 TESTS 10 156 64000000
239408816 usaya E Dec. 28, 2023, 6:16 p.m. OK PyPy 3-64 TESTS 10 171 68505600
239439331 yhkee0404 E Dec. 29, 2023, 3:55 a.m. OK PyPy 3-64 TESTS 36 186 59904000
239418040 eugalt E Dec. 28, 2023, 7:59 p.m. OK Python 3 TESTS 10 155 35635200
239406334 Aditya_2021125 E Dec. 28, 2023, 5:57 p.m. OK Python 3 TESTS 10 171 35020800
239408887 girisarthak E Dec. 28, 2023, 6:16 p.m. OK Python 3 TESTS 10 171 35123200
239405017 nihalgeorge01 E Dec. 28, 2023, 5:47 p.m. OK Python 3 TESTS 10 171 35123200
239404961 meanup- E Dec. 28, 2023, 5:46 p.m. OK Python 3 TESTS 10 171 46080000
239449451 uttudewan100 E Dec. 29, 2023, 5:57 a.m. OK Python 3 TESTS 36 186 35328000
239426650 hyouchun E Dec. 28, 2023, 10:40 p.m. OK Python 3 TESTS 31 186 35328000
239445201 stang_driver E Dec. 29, 2023, 5:11 a.m. OK Python 3 TESTS 36 186 36556800
239415383 melke_mk E Dec. 28, 2023, 7:25 p.m. OK Python 3 TESTS 10 187 34918400
239412547 v1ncent2 E Dec. 28, 2023, 6:51 p.m. OK Python 3 TESTS 10 202 33792000
239438554 ziggy E Dec. 29, 2023, 3:43 a.m. OK Rust 2021 TESTS 36 46 7987200
239434412 liut E Dec. 29, 2023, 2:26 a.m. OK Rust 2021 TESTS 36 46 7987200
239406578 _a253 E Dec. 28, 2023, 5:59 p.m. OK Rust 2021 TESTS 10 62 20172800
239421974 mogu_stew E Dec. 28, 2023, 9 p.m. OK Rust 2021 TESTS 10 77 9420800

remove filters

Back to search problems