Codeforces Round 898 (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
1873 Codeforces Round 898 (Div. 4) FINISHED False 9000 41873063 Sept. 21, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 16540 ) F Money Trees PROGRAMMING greedy greedy greedy math two pointers

B"Luca is in front of a row of n trees. The i -th tree has a_i fruit and height h_i . He wants to choose a contiguous subarray of the array [h_l, h_{l+1}, ... , h_r] such that for each i ( l <= q i < r ), h_i is divisible ^{ dagger} by h_{i+1} . He will collect all the fruit from each of the trees in the subarray (that is, he will collect a_l + a_{l+1} + ... + a_r fruits). However, if he collects more than k fruits in total, he will get caught. What is the maximum length of a subarray Luca can choose so he doesn't get caught? ^{ dagger} x is divisible by y if the ratio frac{x}{y} is an integer. The first line contains a single integer t ( 1 <= q t <= q 1000 ) -- the number of test cases. The first of each test case line contains two space-separated integers n and k ( 1 <= q n <= q 2 cdot 10^5 ; 1 <= q k <= q 10^9 ) -- the number of trees and the maximum amount of fruits Luca can collect without getting caught. The second line of each test case contains n space-separated integers a_i ( 1 <= q a_i <= q 10^4 ) -- the number of fruits in the i -th tree. The third line of each test case contains n space-separated integers h_i ( 1 <= q h_i <= q 10^9 ) -- the height of the i -th tree. The sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case output a single integer, the length of the maximum length contiguous subarray satisfying the conditions, or 0 if there is no such subarray. In the first test case, Luca can select the subarray with l=1 and r=3 . In the second test case, Luca can select the subarray with l=3 and r=4 . In the third test case, Luca can select the subarray with l=2 and r=2 . "...

Tutorials

120634

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
224532719 NenadDapic F Sept. 21, 2023, 9:05 p.m. OK FPC TESTS 15 93 1638400
224558143 ahmedafeef F Sept. 22, 2023, 4:55 a.m. OK GNU C11 TESTS 15 108 6451200
224521319 Believer__007 F Sept. 21, 2023, 6:48 p.m. OK GNU C++14 TESTS 15 93 1638400
224554182 CW_gjy F Sept. 22, 2023, 3:59 a.m. OK GNU C++14 TESTS 15 93 1638400
224524568 tamminaina_y F Sept. 21, 2023, 7:22 p.m. OK GNU C++14 TESTS 15 93 4812800
224558290 CodeK_G F Sept. 22, 2023, 4:57 a.m. OK GNU C++14 TESTS 15 93 5632000
224520548 dynamo0919 F Sept. 21, 2023, 6:41 p.m. OK GNU C++14 TESTS 15 108 1638400
224562762 dongyinjie001 F Sept. 22, 2023, 5:47 a.m. OK GNU C++14 TESTS 15 108 2457600
224555995 NothingAtall F Sept. 22, 2023, 4:26 a.m. OK GNU C++14 TESTS 15 108 3174400
224531249 CodeforHr F Sept. 21, 2023, 8:42 p.m. OK GNU C++14 TESTS 15 109 1638400
224530051 ronit.bhathija F Sept. 21, 2023, 8:25 p.m. OK GNU C++14 TESTS 15 109 1638400
224556744 JorbanS F Sept. 22, 2023, 4:37 a.m. OK GNU C++14 TESTS 15 109 1638400
224517250 test2341 F Sept. 21, 2023, 6:15 p.m. OK GNU C++17 TESTS 15 108 1638400
224517184 sorcerer_21 F Sept. 21, 2023, 6:14 p.m. OK GNU C++17 TESTS 15 108 1638400
224561588 Nisikto F Sept. 22, 2023, 5:35 a.m. OK GNU C++17 TESTS 15 108 1638400
224562000 BerryPie F Sept. 22, 2023, 5:39 a.m. OK GNU C++17 TESTS 15 108 2457600
224523865 Fury_04 F Sept. 21, 2023, 7:14 p.m. OK GNU C++17 TESTS 15 108 6451200
224560979 roots_lg F Sept. 22, 2023, 5:29 a.m. OK GNU C++17 TESTS 15 109 1638400
224555501 iamattri0001 F Sept. 22, 2023, 4:19 a.m. OK GNU C++17 TESTS 15 109 1638400
224555161 namit_v F Sept. 22, 2023, 4:14 a.m. OK GNU C++17 TESTS 15 109 1638400
224551800 21wh1a0501 F Sept. 22, 2023, 3:32 a.m. OK GNU C++17 TESTS 15 109 1638400
224563966 Mkswll F Sept. 22, 2023, 6 a.m. OK GNU C++17 TESTS 15 109 1638400
224516746 RohanC F Sept. 21, 2023, 6:10 p.m. OK GNU C++17 (64) TESTS 15 62 1638400
224532174 __HACKER__ F Sept. 21, 2023, 8:56 p.m. OK GNU C++17 (64) TESTS 15 62 1638400
224560457 fugelarma F Sept. 22, 2023, 5:23 a.m. OK GNU C++17 (64) TESTS 15 62 3276800
224517565 Hostek F Sept. 21, 2023, 6:17 p.m. OK GNU C++17 (64) TESTS 15 62 4812800
224538255 omar_mahmoud1 F Sept. 21, 2023, 11:10 p.m. OK GNU C++17 (64) TESTS 15 62 4915200
224520739 m0nstercat F Sept. 21, 2023, 6:42 p.m. OK GNU C++17 (64) TESTS 15 62 7987200
224528037 imbad F Sept. 21, 2023, 8:01 p.m. OK GNU C++17 (64) TESTS 15 62 7987200
224534838 Esrael F Sept. 21, 2023, 9:45 p.m. OK GNU C++17 (64) TESTS 15 77 1638400
224555188 ashikaslam F Sept. 22, 2023, 4:14 a.m. OK GNU C++17 (64) TESTS 15 77 3174400
224561968 zhi_fan F Sept. 22, 2023, 5:39 a.m. OK GNU C++17 (64) TESTS 15 77 3174400
224531179 Kirkon F Sept. 21, 2023, 8:41 p.m. OK GNU C++20 (64) TESTS 15 46 1638400
224524095 Viktor36 F Sept. 21, 2023, 7:17 p.m. OK GNU C++20 (64) TESTS 15 46 1638400
224523187 SANKI F Sept. 21, 2023, 7:07 p.m. OK GNU C++20 (64) TESTS 15 46 1638400
224516742 m3xD F Sept. 21, 2023, 6:10 p.m. OK GNU C++20 (64) TESTS 15 46 1638400
224517975 Karthik_245 F Sept. 21, 2023, 6:20 p.m. OK GNU C++20 (64) TESTS 15 46 1638400
224561683 Dorayakiee_Fan F Sept. 22, 2023, 5:36 a.m. OK GNU C++20 (64) TESTS 15 46 1638400
224555165 LuSter_Maker F Sept. 22, 2023, 4:14 a.m. OK GNU C++20 (64) TESTS 15 46 1638400
224547490 ma369 F Sept. 22, 2023, 2:25 a.m. OK GNU C++20 (64) TESTS 15 46 1638400
224537643 Fathy0 F Sept. 21, 2023, 10:52 p.m. OK GNU C++20 (64) TESTS 15 46 1638400
224555771 Duiaao F Sept. 22, 2023, 4:23 a.m. OK GNU C++20 (64) TESTS 15 46 3174400
224550532 sarvesh_bawari F Sept. 22, 2023, 3:13 a.m. OK Java 11 TESTS 15 217 37580800
224523186 arajeev210 F Sept. 21, 2023, 7:07 p.m. OK Java 11 TESTS 15 233 2355200
224528514 kasiru_69 F Sept. 21, 2023, 8:06 p.m. OK Java 11 TESTS 15 249 4300800
224532514 dark_rays F Sept. 21, 2023, 9:02 p.m. OK Java 11 TESTS 15 265 5017600
224536972 ahmed_labib F Sept. 21, 2023, 10:35 p.m. OK Java 11 TESTS 15 342 32768000
224519178 creativegiant F Sept. 21, 2023, 6:30 p.m. OK Java 11 TESTS 15 343 13721600
224556907 TopSafder F Sept. 22, 2023, 4:39 a.m. OK Java 11 TESTS 15 358 13312000
224553023 yatharthjohari F Sept. 22, 2023, 3:50 a.m. OK Java 11 TESTS 15 638 0
224518531 jinx_vi F Sept. 21, 2023, 6:25 p.m. OK Java 11 TESTS 15 654 0
224516584 RaHuL_SiNgH22 F Sept. 21, 2023, 6:09 p.m. OK Java 11 TESTS 15 655 0
224547353 Asnkkzk F Sept. 22, 2023, 2:22 a.m. OK Java 17 TESTS 15 233 716800
224522271 maurya.rahul682 F Sept. 21, 2023, 6:58 p.m. OK Java 17 TESTS 15 265 4812800
224563341 Nagendravarma F Sept. 22, 2023, 5:53 a.m. OK Java 17 TESTS 15 280 5529600
224547472 vikash_45 F Sept. 22, 2023, 2:24 a.m. OK Java 17 TESTS 15 295 8089600
224552671 vikash_45 F Sept. 22, 2023, 3:45 a.m. OK Java 17 TESTS 15 296 8396800
224547934 fightingxjz F Sept. 22, 2023, 2:32 a.m. OK Java 17 TESTS 15 311 7475200
224526422 venkateshyeturi F Sept. 21, 2023, 7:43 p.m. OK Java 17 TESTS 15 311 17817600
224563500 fightingxjz F Sept. 22, 2023, 5:55 a.m. OK Java 17 TESTS 15 327 6963200
224523335 daksh_02 F Sept. 21, 2023, 7:08 p.m. OK Java 17 TESTS 15 358 9318400
224522955 dakshkhullar14 F Sept. 21, 2023, 7:04 p.m. OK Java 17 TESTS 15 358 9318400
224527251 Sumitsingh7 F Sept. 21, 2023, 7:52 p.m. OK Java 8 TESTS 15 140 21401600
224548186 Zhanzhe_Lee F Sept. 22, 2023, 2:36 a.m. OK Java 8 TESTS 15 155 11161600
224522390 Yousef_Badr F Sept. 21, 2023, 6:59 p.m. OK Java 8 TESTS 15 171 10956800
224522359 faresbadr316 F Sept. 21, 2023, 6:58 p.m. OK Java 8 TESTS 15 171 10956800
224549913 1091857051 F Sept. 22, 2023, 3:04 a.m. OK Java 8 TESTS 15 171 12390400
224544562 Zhanzhe_Lee F Sept. 22, 2023, 1:35 a.m. OK Java 8 TESTS 15 187 11161600
224545362 kewosihuzuobudao F Sept. 22, 2023, 1:50 a.m. OK Java 8 TESTS 15 187 14745600
224515613 arutsudar F Sept. 21, 2023, 6:02 p.m. OK Java 8 TESTS 15 202 10342400
224549525 Autunomy F Sept. 22, 2023, 2:57 a.m. OK Java 8 TESTS 15 202 10956800
224551208 priyaroy3370 F Sept. 22, 2023, 3:23 a.m. OK Java 8 TESTS 15 405 77926400
224531501 sanjayrathva091 F Sept. 21, 2023, 8:46 p.m. OK Node.js TESTS 15 171 29286400
224546477 YMSeah F Sept. 22, 2023, 2:08 a.m. OK PyPy 3 TESTS 15 171 19251200
224549862 YMSeah F Sept. 22, 2023, 3:03 a.m. OK PyPy 3 TESTS 15 186 21299200
224525828 Antonio_Colapso_07 F Sept. 21, 2023, 7:36 p.m. OK PyPy 3 TESTS 15 343 27033600
224523574 DRDIV F Sept. 21, 2023, 7:11 p.m. OK PyPy 3 TESTS 15 405 24473600
224543750 julondonor F Sept. 22, 2023, 1:21 a.m. OK PyPy 3 TESTS 15 436 21196800
224525746 Antonio_Colapso_07 F Sept. 21, 2023, 7:35 p.m. OK PyPy 3 TESTS 15 452 21299200
224550500 MinhQNgo F Sept. 22, 2023, 3:12 a.m. OK PyPy 3 TESTS 15 467 20889600
224535181 samliu12 F Sept. 21, 2023, 9:52 p.m. OK PyPy 3 TESTS 15 546 21708800
224533946 Dert30 F Sept. 21, 2023, 9:27 p.m. OK PyPy 3-64 TESTS 15 155 25907200
224516671 Super_Misha F Sept. 21, 2023, 6:10 p.m. OK PyPy 3-64 TESTS 15 155 31948800
224546434 hk_brave F Sept. 22, 2023, 2:07 a.m. OK PyPy 3-64 TESTS 15 155 32051200
224546117 harshk_52 F Sept. 22, 2023, 2:03 a.m. OK PyPy 3-64 TESTS 15 155 32358400
224540412 HaonnoaH F Sept. 22, 2023, 12:11 a.m. OK PyPy 3-64 TESTS 15 155 32358400
224524201 gardengnome F Sept. 21, 2023, 7:18 p.m. OK PyPy 3-64 TESTS 15 155 32665600
224530468 aayush_chhabra F Sept. 21, 2023, 8:31 p.m. OK PyPy 3-64 TESTS 15 155 41881600
224534923 YuraK F Sept. 21, 2023, 9:47 p.m. OK PyPy 3-64 TESTS 15 156 23347200
224524226 stand_by F Sept. 21, 2023, 7:18 p.m. OK PyPy 3-64 TESTS 15 171 32256000
224544431 Solaca F Sept. 22, 2023, 1:33 a.m. OK PyPy 3-64 TESTS 15 171 32358400
224519548 YIVI F Sept. 21, 2023, 6:33 p.m. OK Python 3 TESTS 15 218 36864000
224519389 layzer F Sept. 21, 2023, 6:31 p.m. OK Python 3 TESTS 15 218 36864000
224536082 Ysb04 F Sept. 21, 2023, 10:14 p.m. OK Python 3 TESTS 15 233 35328000
224518792 changrun F Sept. 21, 2023, 6:27 p.m. OK Python 3 TESTS 15 233 36147200
224550742 dvspvk05 F Sept. 22, 2023, 3:16 a.m. OK Python 3 TESTS 15 265 36761600
224560380 pjaehyun F Sept. 22, 2023, 5:22 a.m. OK Python 3 TESTS 15 280 35737600
224554638 AhsanRandhawa F Sept. 22, 2023, 4:06 a.m. OK Python 3 TESTS 15 280 36044800
224524624 VioletVal F Sept. 21, 2023, 7:22 p.m. OK Python 3 TESTS 15 295 36864000
224550855 hckim F Sept. 22, 2023, 3:18 a.m. OK Python 3 TESTS 15 296 36761600
224552205 NothingAtall F Sept. 22, 2023, 3:38 a.m. OK Python 3 TESTS 15 296 37273600

remove filters

Back to search problems