Codeforces Round 1025 (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
2109 Codeforces Round 1025 (Div. 2) FINISHED False 8100 28913123 May 17, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 3175 ) C3 Hacking Numbers (Hard Version) PROGRAMMING constructive algorithms interactive math number theory

This is the hard version of the problem. In this version, the limit of commands you can send is described in the statement. You can make hacks only if all versions of the problem are solved. This is an interactive problem. Welcome, Duelists! In this interactive challenge, there is an unknown integer (x) ((1 \le x \le 10^9)). You must make it equal to a given integer in the input (n). By harnessing the power of "Mathmech" monsters, you can send a command to do one of the following: Let (f(n)) be the minimum integer such that there is a sequence of (f(n)) commands that transforms (x) into (n) for all (x(1 \le x \le 10^9)). You do not know the value of (x) in advance. Find (f(n)) such that, no matter what (x) is, you can always transform it into (n) using at most (f(n)) commands. Your task is to change (x) into (n) using at most (f(n)) commands. (^{\text{∗}})(S(n)) is a function that returns the sum of all the individual digits of a non-negative integer (n). For example, (S(123) = 1 + 2 + 3 = 6) Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 5000)). The description of the test cases follows. The first and only line of each test case contains one integer (n) ((1 \le n \le 10^9)). The interaction for each test case begins by reading the integer (n). To send a command, output a line in the following format: "add (y)" Add some integer (y) ((-10^{18} \le y \le 10^{18})) to (x). The jury will output "1" if (x + y) is within (1, 10^{18}) ( successful ), and "0" otherwise. If successful, update (x \leftarrow x + y). The jury will output "1" if (x + y) is within (1, 10^{18}) ( successful ), and "0" otherwise. If successful, update (x \leftarrow x + y). "mul (y)" Multiply (x) by a positive integer (y) ((1 \le y \le 10^{18})). The jury will output "1" if

Tutorials

Codeforces Round 1025 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
320139831 og.kostya C3 May 17, 2025, 6:12 p.m. OK C# 10 TESTS 20 234 819200
320178174 iroseka_shinku C3 May 18, 2025, 4:06 a.m. OK C++17 (GCC 7-32) TESTS 20 171 0
320174099 lonely_warrior_lak0708 C3 May 18, 2025, 3:54 a.m. OK C++17 (GCC 7-32) TESTS 20 171 102400
320154347 Radman_ C3 May 17, 2025, 8:35 p.m. OK C++17 (GCC 7-32) TESTS 20 171 102400
320181690 vishwatej_shende C3 May 18, 2025, 4:56 a.m. OK C++17 (GCC 7-32) TESTS 20 186 102400
320171762 algoridam61 C3 May 18, 2025, 3:19 a.m. OK C++17 (GCC 7-32) TESTS 20 187 0
320149658 tic_tac C3 May 17, 2025, 7:33 p.m. OK C++17 (GCC 7-32) TESTS 20 187 0
320140872 Guts19 C3 May 17, 2025, 6:17 p.m. OK C++17 (GCC 7-32) TESTS 20 187 0
320140657 psi241 C3 May 17, 2025, 6:16 p.m. OK C++17 (GCC 7-32) TESTS 20 187 0
320185898 BreakingGood C3 May 18, 2025, 5:42 a.m. OK C++17 (GCC 7-32) TESTS 20 187 102400
320183926 GAG47 C3 May 18, 2025, 5:22 a.m. OK C++17 (GCC 7-32) TESTS 20 187 102400
320170323 fishcathu C3 May 18, 2025, 2:57 a.m. OK C++20 (GCC 13-64) TESTS 20 155 102400
320143090 AMBeheshti C3 May 17, 2025, 6:30 p.m. OK C++20 (GCC 13-64) TESTS 20 156 0
320142772 Antila C3 May 17, 2025, 6:28 p.m. OK C++20 (GCC 13-64) TESTS 20 156 102400
320160173 Homz C3 May 17, 2025, 10:40 p.m. OK C++20 (GCC 13-64) TESTS 20 171 0
320158684 jaindhairya2001 C3 May 17, 2025, 9:56 p.m. OK C++20 (GCC 13-64) TESTS 20 171 0
320145779 SajidAbdullah C3 May 17, 2025, 6:53 p.m. OK C++20 (GCC 13-64) TESTS 20 171 0
320183554 Ahnaf_Shahriar C3 May 18, 2025, 5:18 a.m. OK C++20 (GCC 13-64) TESTS 20 171 102400
320182539 Krrishchanchal C3 May 18, 2025, 5:06 a.m. OK C++20 (GCC 13-64) TESTS 20 171 102400
320182141 MrPython C3 May 18, 2025, 5:02 a.m. OK C++20 (GCC 13-64) TESTS 20 171 102400
320174921 f2021ljh C3 May 18, 2025, 4:05 a.m. OK C++20 (GCC 13-64) TESTS 20 171 102400
320165144 _bro_ C3 May 18, 2025, 1:21 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 156 102400
320185698 Aegleseekers C3 May 18, 2025, 5:40 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 0
320170842 msp_008987 C3 May 18, 2025, 3:05 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 0
320185357 lnvictus C3 May 18, 2025, 5:37 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 102400
320181530 Co_Well C3 May 18, 2025, 4:54 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 102400
320174001 sumanth7 C3 May 18, 2025, 3:52 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 102400
320171668 stephitnoob C3 May 18, 2025, 3:18 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 102400
320170703 lord_of_the_flies C3 May 18, 2025, 3:03 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 102400
320165064 L_rose_plus C3 May 18, 2025, 1:19 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 102400
320164081 bibhuti.bat C3 May 18, 2025, 12:53 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 102400
320181490 afeefbhai C3 May 18, 2025, 4:54 a.m. OK GNU C11 TESTS 20 265 8396800
320186940 priyaroy3370 C3 May 18, 2025, 5:52 a.m. OK Java 21 TESTS 20 718 1024000
320155023 Master_Shifu46 C3 May 17, 2025, 8:46 p.m. OK Java 21 TESTS 20 733 2048000
320131422 This_Is_Amazing C3 May 17, 2025, 4:45 p.m. OK Java 21 TESTS 20 781 2150400
320149229 sad_truant C3 May 17, 2025, 7:29 p.m. OK Java 21 TESTS 20 812 1536000
320167135 minuki646 C3 May 18, 2025, 2:04 a.m. OK PyPy 3-64 TESTS 20 327 4505600
320156710 kavorka C3 May 17, 2025, 9:16 p.m. OK PyPy 3-64 TESTS 20 389 4403200
320130353 FrankLeDank C3 May 17, 2025, 4:43 p.m. OK PyPy 3-64 TESTS 20 437 5222400
320163694 wabadabakalakaboo C3 May 18, 2025, 12:40 a.m. OK PyPy 3-64 TESTS 20 484 4710400
320173235 vss103824_Umar.Farooq C3 May 18, 2025, 3:41 a.m. OK PyPy 3-64 TESTS 20 484 5222400
320172437 vss103824_Umar.Farooq C3 May 18, 2025, 3:29 a.m. OK PyPy 3-64 TESTS 20 484 5222400
320181318 quad_wipe C3 May 18, 2025, 4:52 a.m. OK PyPy 3-64 TESTS 20 500 5939200
320141997 date_2.0 C3 May 17, 2025, 6:23 p.m. OK PyPy 3-64 TESTS 20 514 4812800
320133884 tqa236 C3 May 17, 2025, 4:49 p.m. OK PyPy 3-64 TESTS 20 514 5120000
320161267 7_divided_by_3 C3 May 17, 2025, 11:14 p.m. OK PyPy 3-64 TESTS 20 515 5222400
320179096 biltharesatyendra C3 May 18, 2025, 4:20 a.m. OK Python 2 TESTS 20 296 0
320182242 ibrahim1963 C3 May 18, 2025, 5:03 a.m. OK Python 3 TESTS 20 374 409600
320141474 Divyanshu_81 C3 May 17, 2025, 6:20 p.m. OK Python 3 TESTS 20 405 614400
320173809 fujishu C3 May 18, 2025, 3:50 a.m. OK Rust 2021 TESTS 20 218 0
320146403 SnowballSH C3 May 17, 2025, 6:59 p.m. OK Rust 2021 TESTS 20 265 102400

remove filters

Back to search problems