Codeforces Round 748 (Div. 3)

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
1593 Codeforces Round 748 (Div. 3) FINISHED False 8100 97687499 Oct. 13, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2465 ) F Red-Black Number PROGRAMMING dp implementation math

B'It is given a non-negative integer x , the decimal representation of which contains n digits. You need to color each its digit in red or black, so that the number formed by the red digits is divisible by A , and the number formed by the black digits is divisible by B . At least one digit must be colored in each of two colors. Consider, the count of digits colored in red is r and the count of digits colored in black is b . Among all possible colorings of the given number x , you need to output any such that the value of |r - b| is the minimum possible. Note that the number x and the numbers formed by digits of each color, may contain leading zeros. The figure above shows an example of painting the number x = 02165 of n = 5 digits for A = 3 and B = 13 . The red digits form the number 015 , which is divisible by 3 , and the black ones -- 26 , which is divisible by 13 . Note that the absolute value of the difference between the counts of red and black digits is 1 , it is impossible to achieve a smaller value. The first line contains one integer t ( 1 <= t <= 10 ) -- the number of test cases. Then t test cases follow. Each test case consists of two lines. The first line contains three integers n , A , B ( 2 <= n <= 40 , 1 <= A, B <= 40 ). The second line contains a non-negative integer x containing exactly n digits and probably containing leading zeroes. For each test case, output in a separate line: The number formed by digits colored red should divisible by A . The number formed by digits colored black should divisible by B . The value |r-b| should be minimal, where r is the count of red digits, b is the count of black digits. If there are many possible answers, print any of them. The first test case is considered in the statement. In the second test case, there are no even di'...

Tutorials

Editorial for Codeforces Round #748 (Div.3)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
131958567 working_cell F Oct. 14, 2021, 4:12 p.m. OK GNU C++14 TESTS 21 46 15564800
131938820 loideptrai1 F Oct. 14, 2021, 12:59 p.m. OK GNU C++14 TESTS 21 78 12492800
131996288 _Fake4Fun F Oct. 15, 2021, 5:53 a.m. OK GNU C++14 TESTS 21 78 14131200
131987598 zhouyuheng2009 F Oct. 15, 2021, 2:40 a.m. OK GNU C++14 TESTS 21 78 62668800
131905416 sorry_thebighead F Oct. 14, 2021, 7:30 a.m. OK GNU C++14 TESTS 21 93 13721600
131936448 wanghai673 F Oct. 14, 2021, 12:39 p.m. OK GNU C++14 TESTS 21 93 24985600
131988365 SkqLiiiao F Oct. 15, 2021, 3 a.m. OK GNU C++14 TESTS 21 93 28057600
131951821 Maystern F Oct. 14, 2021, 3 p.m. OK GNU C++14 TESTS 21 93 56627200
131915998 tcm F Oct. 14, 2021, 9:23 a.m. OK GNU C++14 TESTS 21 109 3891200
131912725 xslxsl F Oct. 14, 2021, 8:49 a.m. OK GNU C++14 TESTS 21 109 13721600
131936381 Hoppz F Oct. 14, 2021, 12:39 p.m. OK GNU C++17 TESTS 21 46 6246400
131951746 GennadyTran F Oct. 14, 2021, 2:59 p.m. OK GNU C++17 TESTS 21 62 819200
131951935 GennadyTran F Oct. 14, 2021, 3:01 p.m. OK GNU C++17 TESTS 21 62 921600
131993573 panyaoyu1999 F Oct. 15, 2021, 5:02 a.m. OK GNU C++17 TESTS 21 62 6246400
131936187 Hoppz F Oct. 14, 2021, 12:37 p.m. OK GNU C++17 TESTS 21 62 6246400
131929367 ikaurov F Oct. 14, 2021, 11:36 a.m. OK GNU C++17 TESTS 21 77 3174400
131936184 little_lion F Oct. 14, 2021, 12:37 p.m. OK GNU C++17 TESTS 21 77 12288000
131954510 mananghetia F Oct. 14, 2021, 3:30 p.m. OK GNU C++17 TESTS 21 77 14438400
131980718 voluntaryway F Oct. 14, 2021, 10:23 p.m. OK GNU C++17 TESTS 21 77 36966400
131979877 rspr F Oct. 14, 2021, 9:53 p.m. OK GNU C++17 TESTS 21 78 2662400
131904657 MAOoo F Oct. 14, 2021, 7:22 a.m. OK GNU C++17 (64) TESTS 21 15 512000
131938222 qiuzx F Oct. 14, 2021, 12:54 p.m. OK GNU C++17 (64) TESTS 21 31 921600
131987606 zzdrws F Oct. 15, 2021, 2:40 a.m. OK GNU C++17 (64) TESTS 21 77 54272000
131927693 xiaofan7 F Oct. 14, 2021, 11:20 a.m. OK GNU C++17 (64) TESTS 21 77 60108800
131985047 Zesty_Fox F Oct. 15, 2021, 1:24 a.m. OK GNU C++17 (64) TESTS 21 93 8192000
131972256 java. F Oct. 14, 2021, 7:06 p.m. OK GNU C++17 (64) TESTS 21 93 25497600
131915323 Blueqwq F Oct. 14, 2021, 9:17 a.m. OK GNU C++17 (64) TESTS 21 93 32870400
131904889 yfy20020106 F Oct. 14, 2021, 7:24 a.m. OK GNU C++17 (64) TESTS 21 108 22220800
131961390 Qiping_yan.cn F Oct. 14, 2021, 4:44 p.m. OK GNU C++17 (64) TESTS 21 109 1433600
131985112 Zesty_Fox F Oct. 15, 2021, 1:27 a.m. OK GNU C++17 (64) TESTS 21 109 8192000
131926930 akshatj07 F Oct. 14, 2021, 11:13 a.m. OK Java 11 TESTS 21 529 819200
131914694 Restricted F Oct. 14, 2021, 9:10 a.m. OK Java 11 TESTS 21 607 79462400
131955649 pikachu_pika_pika F Oct. 14, 2021, 3:41 p.m. OK Java 8 TESTS 21 623 43110400
131958024 bkifhr9 F Oct. 14, 2021, 4:06 p.m. OK Java 8 TESTS 21 857 33689600
131958058 Akram-Adel F Oct. 14, 2021, 4:06 p.m. OK Java 8 TESTS 21 873 33689600
131967281 TCchen F Oct. 14, 2021, 5:55 p.m. OK Java 8 TESTS 21 951 40345600
131950789 3DpoNCh1k F Oct. 14, 2021, 2:47 p.m. OK Kotlin 1.5 TESTS 21 639 2252800
131978839 Eldies F Oct. 14, 2021, 9:23 p.m. OK MS C++ 2017 TESTS 21 264 24268800
131924535 misorin F Oct. 14, 2021, 10:52 a.m. OK PyPy 3 TESTS 21 327 16691200
131986096 codicon F Oct. 15, 2021, 2 a.m. OK PyPy 3 TESTS 21 763 45158400
131915445 NKUCristiano F Oct. 14, 2021, 9:18 a.m. OK PyPy 3 TESTS 21 811 45670400
131977546 lemiao12 F Oct. 14, 2021, 8:48 p.m. OK PyPy 3 TESTS 21 826 46182400
131986204 codicon F Oct. 15, 2021, 2:04 a.m. OK PyPy 3 TESTS 21 826 105267200
131945875 sh1194 F Oct. 14, 2021, 2:01 p.m. OK PyPy 3 TESTS 21 873 45363200
131954077 nicku123 F Oct. 14, 2021, 3:25 p.m. OK PyPy 3 TESTS 21 982 27545600
131942717 vwxyz0 F Oct. 14, 2021, 1:32 p.m. OK PyPy 3 TESTS 21 998 73728000
131989194 t3a F Oct. 15, 2021, 3:20 a.m. OK PyPy 3-64 TESTS 21 857 75571200
131947677 Spheniscine F Oct. 14, 2021, 2:17 p.m. OK Rust TESTS 21 187 23244800

remove filters

Back to search problems