Codeforces Round 1024 (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
2102 Codeforces Round 1024 (Div. 2) FINISHED False 9000 29431523 May 11, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 21339 ) A Dinner Time PROGRAMMING constructive algorithms math

Given four integers (n), (m), (p), and (q), determine whether there exists an integer array (a_1, a_2, \ldots, a_n) (elements may be negative) satisfying the following conditions: The sum of all elements in the array is equal to (m): ()a_1 + a_2 + \ldots + a_n = m() The sum of every (p) consecutive elements is equal to (q): ()a_i + a_{i + 1} + \ldots + a_{i + p - 1} = q,\qquad\text{ for all }1\le i\le n-p+1() Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first and only line of each test case contains four integers (n), (m), (p), and (q) ((1 \le p \le n \le 100), (1 \le q, m \le 100)) — the length of the array, the sum of elements, the length of a segment, and the sum of a segment, respectively. For each test case, output " YES " (without quotes) if there exists an array satisfying the above conditions, and " NO " (without quotes) otherwise. You can output " YES " and " NO " in any case (for example, strings " yES ", " yes ", and " Yes " will all be recognized as valid responses). In the first test case, an example of an array satisfying the condition is (1, 0, 1). This is because: (a_1+a_2+a_3 = 1+0+1 = 2 = m) (a_1+a_2=1+0=1=q) (a_2+a_3=0+1=1=q) In the second test case, the only array satisfying the condition is (1). In the third test case, an example of an array satisfying the condition is (-2, 5, -2, 5, -2). In the fourth test case, it can be proven that there is no array satisfying the condition.

Tutorials

142788

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
319328690 og.kostya A May 12, 2025, 5:14 a.m. OK C# 10 TESTS 3 77 0
319331118 IRacle A May 12, 2025, 5:42 a.m. OK C# 10 TESTS 3 93 2662400
319295858 AlRntn A May 11, 2025, 6:10 p.m. OK C++17 (GCC 7-32) TESTS 3 30 0
319315968 Someshreddy A May 12, 2025, 1:09 a.m. OK C++17 (GCC 7-32) TESTS 3 31 0
319309047 real_Parallelism A May 11, 2025, 9:25 p.m. OK C++17 (GCC 7-32) TESTS 3 31 0
319302762 Aman_pathan A May 11, 2025, 7:32 p.m. OK C++17 (GCC 7-32) TESTS 3 31 0
319301533 agprateek7 A May 11, 2025, 7:15 p.m. OK C++17 (GCC 7-32) TESTS 3 31 0
319297355 eccentricVedP A May 11, 2025, 6:25 p.m. OK C++17 (GCC 7-32) TESTS 3 31 0
319280839 uagmire A May 11, 2025, 4:33 p.m. OK C++17 (GCC 7-32) TESTS 3 31 0
319278195 djarnob12 A May 11, 2025, 4:25 p.m. OK C++17 (GCC 7-32) TESTS 3 31 0
319276836 roybiraj179 A May 11, 2025, 4:21 p.m. OK C++17 (GCC 7-32) TESTS 3 31 0
319276699 ashupali A May 11, 2025, 4:21 p.m. OK C++17 (GCC 7-32) TESTS 3 31 0
319317422 jatin1009 A May 12, 2025, 1:52 a.m. OK C++20 (GCC 13-64) TESTS 3 30 0
319317414 xie_T34 A May 12, 2025, 1:52 a.m. OK C++20 (GCC 13-64) TESTS 3 30 0
319316889 kekao A May 12, 2025, 1:37 a.m. OK C++20 (GCC 13-64) TESTS 3 30 0
319296507 OTC A May 11, 2025, 6:16 p.m. OK C++20 (GCC 13-64) TESTS 3 30 0
319287831 noob_jay A May 11, 2025, 4:56 p.m. OK C++20 (GCC 13-64) TESTS 3 30 102400
319326663 AMIN_AL_ISLAM A May 12, 2025, 4:48 a.m. OK C++20 (GCC 13-64) TESTS 3 31 0
319324508 StRabbit A May 12, 2025, 4:12 a.m. OK C++20 (GCC 13-64) TESTS 3 31 0
319319301 shanto_123 A May 12, 2025, 2:36 a.m. OK C++20 (GCC 13-64) TESTS 3 31 0
319318062 shr3yan A May 12, 2025, 2:07 a.m. OK C++20 (GCC 13-64) TESTS 3 31 0
319316470 Additionlly A May 12, 2025, 1:25 a.m. OK C++20 (GCC 13-64) TESTS 3 31 0
319321544 Pota_tO A May 12, 2025, 3:21 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 30 0
319297770 Parveen125690 A May 11, 2025, 6:29 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 30 0
319276210 kavin_coding05 A May 11, 2025, 4:19 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 30 0
319294163 jigyasu_kalyan A May 11, 2025, 5:57 p.m. OK C++23 (GCC 14-64, msys2) TESTS 3 30 102400
319330661 Ethanyuan A May 12, 2025, 5:37 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 31 0
319330194 codinglbj23 A May 12, 2025, 5:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 31 0
319329403 Williamtym A May 12, 2025, 5:23 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 31 0
319328902 k.abhiram A May 12, 2025, 5:17 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 31 0
319327618 AryanMotiani A May 12, 2025, 5:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 31 0
319327007 MatthewC3297 A May 12, 2025, 4:53 a.m. OK C++23 (GCC 14-64, msys2) TESTS 3 31 0
319324451 ling_yue A May 12, 2025, 4:11 a.m. OK GNU C11 TESTS 3 46 0
319317378 stormer_23 A May 12, 2025, 1:51 a.m. OK GNU C11 TESTS 3 77 0
319285723 Guna_7214 A May 11, 2025, 4:49 p.m. OK GNU C11 TESTS 3 77 0
319325521 muradbhai A May 12, 2025, 4:29 a.m. OK GNU C11 TESTS 3 92 102400
319330676 nahida520 A May 12, 2025, 5:37 a.m. OK GNU C11 TESTS 3 93 0
319278706 beastb728 A May 11, 2025, 4:27 p.m. OK GNU C11 TESTS 3 93 0
319295493 petla A May 11, 2025, 6:06 p.m. OK GNU C11 TESTS 3 93 102400
319288126 Finnigan_Goldcoin A May 11, 2025, 4:57 p.m. OK Go TESTS 3 124 1843200
319313634 aswin_t A May 11, 2025, 11:53 p.m. OK Java 21 TESTS 3 187 0
319312577 bomakhamchha A May 11, 2025, 11:20 p.m. OK Java 21 TESTS 3 187 204800
319325068 LordKRiS A May 12, 2025, 4:21 a.m. OK Java 21 TESTS 3 218 409600
319285807 YZH_1014 A May 11, 2025, 4:49 p.m. OK Java 21 TESTS 3 218 512000
319332714 69stranger69 A May 12, 2025, 6:02 a.m. OK Java 21 TESTS 3 218 1024000
319310548 Master_Shifu46 A May 11, 2025, 10:08 p.m. OK Java 21 TESTS 3 218 1024000
319289251 vatsal_04 A May 11, 2025, 5 p.m. OK Java 21 TESTS 3 233 409600
319301387 JGebauer A May 11, 2025, 7:13 p.m. OK Java 21 TESTS 3 233 1536000
319329525 tekka_ity A May 12, 2025, 5:25 a.m. OK Java 21 TESTS 3 234 819200
319279482 Gaurav_kumar18 A May 11, 2025, 4:29 p.m. OK Java 21 TESTS 3 249 921600
319329724 umeshverma07 A May 12, 2025, 5:27 a.m. OK Java 8 TESTS 3 139 0
319321027 Trouble_shooter A May 12, 2025, 3:10 a.m. OK Java 8 TESTS 3 140 0
319325109 NeelmaniPandey09 A May 12, 2025, 4:22 a.m. OK Java 8 TESTS 3 202 0
319311926 JavaFirst A May 11, 2025, 10:54 p.m. OK Java 8 TESTS 3 217 0
319327226 priyanshu3003 A May 12, 2025, 4:56 a.m. OK Java 8 TESTS 3 218 0
319303306 ansariwajid A May 11, 2025, 7:39 p.m. OK Java 8 TESTS 3 218 0
319295753 sum55 A May 11, 2025, 6:09 p.m. OK Java 8 TESTS 3 218 0
319322762 abhaysolanki1712 A May 12, 2025, 3:42 a.m. OK Java 8 TESTS 3 234 0
319288081 vive02-xo A May 11, 2025, 4:56 p.m. OK Java 8 TESTS 3 249 0
319330005 arnabpachal2004 A May 12, 2025, 5:30 a.m. OK Java 8 TESTS 3 265 0
319286499 nurbold A May 11, 2025, 4:52 p.m. OK Kotlin 1.7 TESTS 3 343 6860800
319329739 samulokito14 A May 12, 2025, 5:28 a.m. OK Node.js TESTS 3 187 7577600
319298738 ManasJain A May 11, 2025, 6:40 p.m. OK PyPy 3 TESTS 3 155 5939200
319306525 Toinfinity A May 11, 2025, 8:31 p.m. OK PyPy 3 TESTS 3 218 5734400
319296114 Srivissy A May 11, 2025, 6:12 p.m. OK PyPy 3 TESTS 3 233 5836800
319296707 aayushprasad00691 A May 11, 2025, 6:18 p.m. OK PyPy 3 TESTS 3 249 5836800
319296791 gr_priyk A May 11, 2025, 6:19 p.m. OK PyPy 3 TESTS 3 265 6144000
319321147 johan_1975 A May 12, 2025, 3:13 a.m. OK PyPy 3-64 TESTS 3 77 4300800
319294075 gardengnome A May 11, 2025, 5:56 p.m. OK PyPy 3-64 TESTS 3 93 2662400
319274977 mirianancco A May 11, 2025, 4:16 p.m. OK PyPy 3-64 TESTS 3 108 3788800
319294707 manya.verma21 A May 11, 2025, 6 p.m. OK PyPy 3-64 TESTS 3 124 3788800
319331672 Canyonzzzzz A May 12, 2025, 5:49 a.m. OK PyPy 3-64 TESTS 3 124 3993600
319323849 shirshendu_sg A May 12, 2025, 4 a.m. OK PyPy 3-64 TESTS 3 124 4403200
319323790 huqingchang A May 12, 2025, 3:59 a.m. OK PyPy 3-64 TESTS 3 139 6963200
319306863 Martinien_ENSAF A May 11, 2025, 8:37 p.m. OK PyPy 3-64 TESTS 3 140 3686400
319274777 sumit042 A May 11, 2025, 4:15 p.m. OK PyPy 3-64 TESTS 3 140 3788800
319309615 WAan A May 11, 2025, 9:39 p.m. OK PyPy 3-64 TESTS 3 140 3891200
319287558 garrett795282 A May 11, 2025, 4:55 p.m. OK Python 3 TESTS 3 61 0
319276424 jessid4st A May 11, 2025, 4:20 p.m. OK Python 3 TESTS 3 61 0
319283307 ramsey403985 A May 11, 2025, 4:41 p.m. OK Python 3 TESTS 3 61 102400
319281969 ferstzorgan3 A May 11, 2025, 4:37 p.m. OK Python 3 TESTS 3 62 0
319288835 osborne727654 A May 11, 2025, 4:59 p.m. OK Python 3 TESTS 3 62 102400
319283014 crazygirl87zorgan A May 11, 2025, 4:40 p.m. OK Python 3 TESTS 3 62 204800
319275128 enhxkvehxg A May 11, 2025, 4:16 p.m. OK Python 3 TESTS 3 62 204800
319286122 evelyn870913 A May 11, 2025, 4:50 p.m. OK Python 3 TESTS 3 62 307200
319318239 eugalt A May 12, 2025, 2:11 a.m. OK Python 3 TESTS 3 62 1228800
319289293 ramukyajiv A May 11, 2025, 5 p.m. OK Python 3 TESTS 3 62 1433600
319299836 sankxt143 A May 11, 2025, 6:52 p.m. OK Rust 2021 TESTS 3 46 0
319278540 blackpanther_7 A May 11, 2025, 4:26 p.m. OK Rust 2021 TESTS 3 46 0
319327485 silicalet A May 12, 2025, 5 a.m. OK Rust 2021 TESTS 3 61 102400

remove filters

Back to search problems