Pinely Round 5 (Div. 1 + Div. 2)

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
2161 Pinely Round 5 (Div. 1 + Div. 2) FINISHED False 10800 14563523 Oct. 30, 2025, 4:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 15653 ) A Round Trip PROGRAMMING games greedy implementation math

Petya and Vasya love participating in Codeforces contests. Vasya made a bet with Petya that he will take part in more rated rounds than him. Initially, Vasya's rating is (R_0). There will be (n) rounds conducted in total, each of one of two types: div. 1 — rated for all participants div. 2 — rated for participants with rating strictly less than (X), and unrated for all others, In an unrated round, Vasya cannot change his rating. If Vasya's rating before a rated round was (R), then for any non-negative integer (x) between (R-D) and (R+D) (inclusive) Vasya can adopt a strategy such that his rating becomes exactly (x) afterwards (here (D) is a positive integer). Note that rating may never become negative. Help Vasya determine the maximum number of rated rounds he can participate in. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 1000)). The description of the test cases follows. The first line of each test case contains four integers: (R_0, X, D, n) ((0 \leq R_0 \leq 10^9), (1 \leq X \leq 10^9), (1 \leq D, n \leq 1000)) — Vasya's initial rating, the rating threshold between divisions, the maximum rating delta, and the number of rounds. The second line of each test case contains a string of size (n). The string will only contain the characters " 1 " and " 2 ", representing div. 1 and div. 2 rounds respectively. The sum of (n) across all test cases does not exceed (3 \cdot 10^4). For each test case, print a single integer — the maximum number of rated rounds Vasya can participate in. In the first example, since (R_0 \geq X), each div. 2 round is unrated for Vasya, so his rating never changes. Therefore, he cannot make any round rated for himself, and the answer is (0). In the second example, one of the optimal sequences of ratings after each round is: $$$2098 \rightarrow 2103 \rightarrow 2101 \rightarrow 2099 \rightarrow 20

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
346721504 ksandr1v A Oct. 30, 2025, 6:44 p.m. OK C# 13 TESTS 4 109 0
346760580 wanderer_13 A Oct. 31, 2025, 3:31 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
346760570 qminh3082008 A Oct. 31, 2025, 3:31 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
346760444 deep_chovatiya A Oct. 31, 2025, 3:30 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
346756762 qminh3082008 A Oct. 31, 2025, 2:33 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
346752733 hieunguyen250507 A Oct. 31, 2025, 1:14 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
346737481 creator_ag A Oct. 30, 2025, 8:14 p.m. OK C++17 (GCC 7-32) TESTS 4 30 0
346741728 dhia05 A Oct. 30, 2025, 9:06 p.m. OK C++17 (GCC 7-32) TESTS 4 30 0
346770559 Alpha_rays A Oct. 31, 2025, 5:28 a.m. OK C++17 (GCC 7-32) TESTS 4 31 0
346772839 kalyan_reddy A Oct. 31, 2025, 5:52 a.m. OK C++17 (GCC 7-32) TESTS 4 31 0
346772355 utkarshsahay674 A Oct. 31, 2025, 5:47 a.m. OK C++17 (GCC 7-32) TESTS 4 31 0
346763021 sleepyAdarsh A Oct. 31, 2025, 4 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
346764230 ZZGZZGZZG A Oct. 31, 2025, 4:14 a.m. OK C++20 (GCC 13-64) TESTS 4 30 102400
346771635 ZengZhaoGan_124 A Oct. 31, 2025, 5:40 a.m. OK C++20 (GCC 13-64) TESTS 4 30 102400
346771200 April_sakura A Oct. 31, 2025, 5:35 a.m. OK C++20 (GCC 13-64) TESTS 4 30 102400
346767852 _kartikey_12 A Oct. 31, 2025, 4:57 a.m. OK C++20 (GCC 13-64) TESTS 4 30 102400
346761381 MonkeySpinning A Oct. 31, 2025, 3:40 a.m. OK C++20 (GCC 13-64) TESTS 4 30 102400
346764269 jatinmeena9594 A Oct. 31, 2025, 4:15 a.m. OK C++20 (GCC 13-64) TESTS 4 31 0
346774284 rudraprajapati5102005 A Oct. 31, 2025, 6:07 a.m. OK C++20 (GCC 13-64) TESTS 4 31 0
346766399 rhk A Oct. 31, 2025, 4:38 a.m. OK C++20 (GCC 13-64) TESTS 4 31 0
346763181 ashu6919 A Oct. 31, 2025, 4:02 a.m. OK C++20 (GCC 13-64) TESTS 4 31 0
346753070 FisherGo A Oct. 31, 2025, 1:21 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
346749324 Pallove A Oct. 30, 2025, 11:44 p.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
346718825 h56bar A Oct. 30, 2025, 6:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
346769683 cp_31 A Oct. 31, 2025, 5:19 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 31 0
346769405 -Aman A Oct. 31, 2025, 5:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 31 0
346765757 asaltfish A Oct. 31, 2025, 4:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 31 0
346761686 XED_STARRY_SKY A Oct. 31, 2025, 3:44 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 31 0
346764744 knlydv A Oct. 31, 2025, 4:20 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 31 0
346771156 YxqK A Oct. 31, 2025, 5:34 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 31 0
346771123 cuongson A Oct. 31, 2025, 5:34 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 31 0
346725397 hollow_knight_25 A Oct. 30, 2025, 6:59 p.m. OK C# 8 TESTS 4 124 716800
346727060 HadHushDJ A Oct. 30, 2025, 7:06 p.m. OK GNU C11 TESTS 4 31 0
346756937 lingkai A Oct. 31, 2025, 2:36 a.m. OK GNU C11 TESTS 4 31 102400
346733781 mdperves06 A Oct. 30, 2025, 7:33 p.m. OK GNU C11 TESTS 4 46 0
346731605 CODER_DEVIL A Oct. 30, 2025, 7:25 p.m. OK GNU C11 TESTS 4 46 0
346715958 kaunrahul A Oct. 30, 2025, 6:24 p.m. OK GNU C11 TESTS 4 46 0
346717930 md_faruk08 A Oct. 30, 2025, 6:31 p.m. OK GNU C11 TESTS 4 46 102400
346713716 dumb100 A Oct. 30, 2025, 6:17 p.m. OK GNU C11 TESTS 4 46 204800
346733597 Rabius_Sunny A Oct. 30, 2025, 7:33 p.m. OK GNU C11 TESTS 4 61 0
346720388 _slayer17 A Oct. 30, 2025, 6:39 p.m. OK GNU C11 TESTS 4 61 0
346712383 EkanCoderX A Oct. 30, 2025, 6:13 p.m. OK GNU C11 TESTS 4 61 102400
346731641 karan_cf A Oct. 30, 2025, 7:25 p.m. OK Java 21 TESTS 4 218 0
346716116 samiabdus9831 A Oct. 30, 2025, 6:25 p.m. OK Java 21 TESTS 4 218 614400
346721765 SumitXorY A Oct. 30, 2025, 6:44 p.m. OK Java 21 TESTS 4 218 716800
346740472 akshat.codes A Oct. 30, 2025, 8:49 p.m. OK Java 21 TESTS 4 218 1126400
346765352 code.breaker23 A Oct. 31, 2025, 4:27 a.m. OK Java 21 TESTS 4 233 0
346768581 nurulmuaj772 A Oct. 31, 2025, 5:06 a.m. OK Java 21 TESTS 4 234 204800
346733533 miguelardo1 A Oct. 30, 2025, 7:32 p.m. OK Java 21 TESTS 4 234 512000
346732988 Wiz_Tanay A Oct. 30, 2025, 7:30 p.m. OK Java 21 TESTS 4 249 307200
346765704 tekka_ity A Oct. 31, 2025, 4:31 a.m. OK Java 21 TESTS 4 264 102400
346764872 learnerview A Oct. 31, 2025, 4:22 a.m. OK Java 21 TESTS 4 264 102400
346769123 ycnetsisnoc A Oct. 31, 2025, 5:12 a.m. OK Java 8 TESTS 4 171 0
346768643 Vishalll_ A Oct. 31, 2025, 5:07 a.m. OK Java 8 TESTS 4 186 0
346770976 asbro3886 A Oct. 31, 2025, 5:33 a.m. OK Java 8 TESTS 4 202 0
346729733 devsac12 A Oct. 30, 2025, 7:17 p.m. OK Java 8 TESTS 4 202 0
346715970 Raja_Kaushal A Oct. 30, 2025, 6:24 p.m. OK Java 8 TESTS 4 217 0
346713900 LEGENDxBo0I5667 A Oct. 30, 2025, 6:18 p.m. OK Java 8 TESTS 4 233 0
346722693 SarthakSharma18 A Oct. 30, 2025, 6:48 p.m. OK PHP TESTS 4 77 102400
346735898 SushiTrash A Oct. 30, 2025, 7:59 p.m. OK PyPy 3 TESTS 4 124 2355200
346714110 ayan.ryukendo A Oct. 30, 2025, 6:18 p.m. OK PyPy 3 TESTS 4 233 4403200
346745189 gizachew980 A Oct. 30, 2025, 10:05 p.m. OK PyPy 3 TESTS 4 233 5324800
346744423 gardengnome A Oct. 30, 2025, 9:50 p.m. OK PyPy 3-64 TESTS 4 77 1638400
346764771 aa_despa A Oct. 31, 2025, 4:21 a.m. OK PyPy 3-64 TESTS 4 77 2355200
346750438 stan23456 A Oct. 31, 2025, 12:16 a.m. OK PyPy 3-64 TESTS 4 77 2355200
346769539 LogicErr A Oct. 31, 2025, 5:17 a.m. OK PyPy 3-64 TESTS 4 93 2150400
346719928 W1nn1e0xb A Oct. 30, 2025, 6:38 p.m. OK PyPy 3-64 TESTS 4 93 3072000
346746533 vatsal2k7 A Oct. 30, 2025, 10:33 p.m. OK PyPy 3-64 TESTS 4 108 2969600
346744776 Bit_shifter A Oct. 30, 2025, 9:56 p.m. OK PyPy 3-64 TESTS 4 108 3072000
346744575 mmoeez48 A Oct. 30, 2025, 9:53 p.m. OK PyPy 3-64 TESTS 4 108 3891200
346737763 RobinFromTheHood A Oct. 30, 2025, 8:17 p.m. OK PyPy 3-64 TESTS 4 109 2457600
346742871 anti_19 A Oct. 30, 2025, 9:23 p.m. OK PyPy 3-64 TESTS 4 109 2969600
346767565 Ekshith A Oct. 31, 2025, 4:54 a.m. OK Python 3 TESTS 4 61 0
346730707 mahidulisalm A Oct. 30, 2025, 7:21 p.m. OK Python 3 TESTS 4 61 0
346729513 Honky A Oct. 30, 2025, 7:16 p.m. OK Python 3 TESTS 4 61 102400
346755364 isanz A Oct. 31, 2025, 2:06 a.m. OK Python 3 TESTS 4 61 204800
346766760 Chuba A Oct. 31, 2025, 4:43 a.m. OK Python 3 TESTS 4 62 0
346758315 IITM_Amrutha_EE24 A Oct. 31, 2025, 2:59 a.m. OK Python 3 TESTS 4 62 0
346747671 eugalt A Oct. 30, 2025, 11:01 p.m. OK Python 3 TESTS 4 62 0
346745629 Balajyothi A Oct. 30, 2025, 10:13 p.m. OK Python 3 TESTS 4 62 0
346722269 Ramper A Oct. 30, 2025, 6:46 p.m. OK Python 3 TESTS 4 62 0
346717748 zarinaabsaliamova A Oct. 30, 2025, 6:30 p.m. OK Python 3 TESTS 4 62 102400
346725387 Dilha_1526 A Oct. 30, 2025, 6:59 p.m. OK Ruby 3 TESTS 4 296 204800

remove filters

Back to search problems