Codeforces Round 1057 (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
2153 Codeforces Round 1057 (Div. 2) FINISHED False 8100 16298723 Oct. 10, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 967 ) E Zero Trailing Factorial PROGRAMMING brute force math number theory

For all positive integers (x\ge 1) and (k\ge 2), let (v_k(x!)) denote the number of trailing zeros in the base-(k) representation of (x! = x\cdot (x-1)\cdot \ldots \cdot 1). Formally, (v_k(x!)) is defined as the largest integer (i) such that (k^i) divides (x!). For a prime number (p), we can calculate (v_p(x!) = \sum\limits_{j=1}^\infty \left\lfloor \frac{x}{p^j}\right\rfloor)(^{\text{∗}}). If (k) is not prime, write its prime factorization as (k = \prod p_i^{e_i}), where (p_i) are distinct prime factors and (e_i) are their corresponding exponents. Then, ()v_k(x!) = \min\limits_i \left\lfloor \frac{v_{p_i}(x!)}{e_i}\right\rfloor.() For any two positive integers (a) and (b), and any integer (k\ge 2), the weight of the pair ((a, b)) with respect to (k), denoted by (w_k(a, b)), is defined as ()w_k(a, b) = \begin{cases}\min(v_k(a!), v_k(b!)) & \text{if }v_k(a!)\neq v_k(b!)\text{;}\\10^{100} & \text{otherwise.}\end{cases}() Next, define (f_m(a, b)) as the minimum weight of the pair ((a, b)) with respect to (k), taken over all integers (k) with (2\le k\le m): ()f_m(a, b)=\min\limits_{2\le k\le m}w_k(a, b).() You are given two integers (n) and (m). Your task is to compute the sum of (f_m(x, n)) over all positive integers (x) less than (n): ()\sum_{1\le x\le n - 1} f_m(x, n).() It can be shown that under the given constraints, the result is strictly less than (10^{100}). (^{\text{∗}})(\lfloor y\rfloor) denotes the floor of (y), which is the greatest integer less than or equal to (y). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 100)). The description of the test cases follows. The first and only line of each test case contains two integers (n) and (m) ((2\le n\le m\le 10^7)) — the parameters of the function

Tutorials

Codeforces Round 1057 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
343054807 sg0071729 E Oct. 11, 2025, 1:48 a.m. OK C++17 (GCC 7-32) TESTS 51 217 42598400
343053864 andreasn E Oct. 11, 2025, 1:26 a.m. OK C++17 (GCC 7-32) TESTS 51 249 102400
343055163 helloa E Oct. 11, 2025, 1:56 a.m. OK C++17 (GCC 7-32) TESTS 51 249 3686400
343032597 NiGhT-h-MaRe E Oct. 10, 2025, 7:13 p.m. OK C++17 (GCC 7-32) TESTS 50 249 10035200
343015093 souls2108 E Oct. 10, 2025, 4:49 p.m. OK C++17 (GCC 7-32) TESTS 50 249 42598400
343034789 log1plusx E Oct. 10, 2025, 7:31 p.m. OK C++17 (GCC 7-32) TESTS 51 249 82636800
343011000 meankitmishra10 E Oct. 10, 2025, 4:40 p.m. OK C++17 (GCC 7-32) TESTS 50 265 3686400
343010879 W_Poly E Oct. 10, 2025, 4:40 p.m. OK C++17 (GCC 7-32) TESTS 50 265 42496000
343027863 MHsweee E Oct. 10, 2025, 6:37 p.m. OK C++17 (GCC 7-32) TESTS 50 312 46182400
343009273 helloa E Oct. 10, 2025, 4:36 p.m. OK C++17 (GCC 7-32) TESTS 50 312 88985600
343062851 caidx E Oct. 11, 2025, 4:01 a.m. OK C++20 (GCC 13-64) TESTS 51 78 102400
343062701 rlc202204 E Oct. 11, 2025, 3:59 a.m. OK C++20 (GCC 13-64) TESTS 51 93 102400
343029858 Jeresalen E Oct. 10, 2025, 6:51 p.m. OK C++20 (GCC 13-64) TESTS 50 109 0
343013258 toilanvd_HUST E Oct. 10, 2025, 4:45 p.m. OK C++20 (GCC 13-64) TESTS 50 186 40140800
343049995 siuhou E Oct. 10, 2025, 11:30 p.m. OK C++20 (GCC 13-64) TESTS 51 187 83660800
343009408 diss_quack E Oct. 10, 2025, 4:36 p.m. OK C++20 (GCC 13-64) TESTS 50 202 0
343011848 CodingPokemon E Oct. 10, 2025, 4:42 p.m. OK C++20 (GCC 13-64) TESTS 50 249 11059200
343054097 lucky_clover_ E Oct. 11, 2025, 1:32 a.m. OK C++20 (GCC 13-64) TESTS 51 249 53657600
343011276 Srijon-return E Oct. 10, 2025, 4:41 p.m. OK C++20 (GCC 13-64) TESTS 50 249 121651200
343039990 Jude_Asaadingham E Oct. 10, 2025, 8:25 p.m. OK C++20 (GCC 13-64) TESTS 51 265 4812800
343063555 424479543 E Oct. 11, 2025, 4:12 a.m. OK C++23 (GCC 14-64, msys2) TESTS 51 62 10342400
343062595 424479543 E Oct. 11, 2025, 3:58 a.m. OK C++23 (GCC 14-64, msys2) TESTS 51 93 10342400
343062522 424479543 E Oct. 11, 2025, 3:57 a.m. OK C++23 (GCC 14-64, msys2) TESTS 51 93 10342400
343008749 fishcathu E Oct. 10, 2025, 4:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 50 108 102400
343060726 424479543 E Oct. 11, 2025, 3:30 a.m. OK C++23 (GCC 14-64, msys2) TESTS 51 109 102400
343060154 424479543 E Oct. 11, 2025, 3:21 a.m. OK C++23 (GCC 14-64, msys2) TESTS 51 171 41472000
343061607 Roll_Num_44 E Oct. 11, 2025, 3:43 a.m. OK C++23 (GCC 14-64, msys2) TESTS 51 202 4915200
343015453 EurekaJJ E Oct. 10, 2025, 4:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 50 218 4915200
343059954 424479543 E Oct. 11, 2025, 3:18 a.m. OK C++23 (GCC 14-64, msys2) TESTS 51 218 41472000
343054322 424479543 E Oct. 11, 2025, 1:36 a.m. OK C++23 (GCC 14-64, msys2) TESTS 51 218 41472000
343009694 atharvahon_109 E Oct. 10, 2025, 4:37 p.m. OK Go TESTS 50 359 33894400
343009949 Aisenh037 E Oct. 10, 2025, 4:37 p.m. OK Java 21 TESTS 50 468 11878400
343009853 Charanjit_11 E Oct. 10, 2025, 4:37 p.m. OK Java 21 TESTS 50 921 43622400
343013519 nikhil.chahar_cs23 E Oct. 10, 2025, 4:46 p.m. OK Java 21 TESTS 50 936 43417600
343010807 rahulsamant0307 E Oct. 10, 2025, 4:39 p.m. OK PyPy 3-64 TESTS 50 561 30617600
343014426 ThatOnePythonUser E Oct. 10, 2025, 4:47 p.m. OK PyPy 3-64 TESTS 50 577 114483200
343073536 kamio-misuzu E Oct. 11, 2025, 5:56 a.m. OK PyPy 3-64 TESTS 51 593 8704000
343023368 x_n E Oct. 10, 2025, 6:12 p.m. OK PyPy 3-64 TESTS 50 796 114585600
343059085 TTO76 E Oct. 11, 2025, 3:05 a.m. OK PyPy 3-64 TESTS 51 921 43008000
343010364 Mukundan314 E Oct. 10, 2025, 4:38 p.m. OK PyPy 3-64 TESTS 50 1015 19660800
343024453 hxu10 E Oct. 10, 2025, 6:17 p.m. OK PyPy 3-64 TESTS 50 1217 117145600
343011074 Sapple_ E Oct. 10, 2025, 4:40 p.m. OK PyPy 3-64 TESTS 50 1827 11468800
343024622 Crbubble E Oct. 10, 2025, 6:18 p.m. OK PyPy 3-64 TESTS 50 2390 246374400
343014698 AL_Qiswa E Oct. 10, 2025, 4:48 p.m. OK Python 3 TESTS 50 2874 47923200

remove filters

Back to search problems