Codeforces Round 879 (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
1834 Codeforces Round 879 (Div. 2) FINISHED False 7200 44747699 June 18, 2023, 8:05 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 15372 ) B Maximum Strength PROGRAMMING greedy math

B'Fedya is playing a new game called "The Legend of Link", in which one of the character 's abilities is to combine two materials into one weapon. Each material has its own strength, which can be represented by a positive integer x . The strength of the resulting weapon is determined as the sum of the absolute differences of the digits in the decimal representation of the integers at each position. Formally, let the first material have strength X = overline{x_{1}x_{2} ldots x_{n}} , and the second material have strength Y = overline{y_{1}y_{2} ldots y_{n}} . Then the strength of the weapon is calculated as |x_{1} - y_{1}| + |x_{2} - y_{2}| + ldots + |x_{n} - y_{n}| . If the integers have different lengths, then the shorter integer is padded with leading zeros. Fedya has an unlimited supply of materials with all possible strengths from L to R , inclusive. Help him find the maximum possible strength of the weapon he can obtain. An integer C = overline{c_{1}c_{2} ldots c_{k}} is defined as an integer obtained by sequentially writing the digits c_1, c_2, ldots, c_k from left to right, i.e. 10^{k-1} cdot c_1 + 10^{k-2} cdot c_2 + ldots + c_k . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 500 ). The description of the test cases follows. The first line of each test case contains two integers L and R ( 1 <= L <= R < 10^{100} ) -- the decimal representation of the integers representing the minimum and maximum strength of the materials that Fedya has. It is guaranteed that the integers L and R do not contain leading zeros. Note that the input data may not fit into standard 32 -bit or 64 -bit integer data types. For each test case print one integer -- the maximum possible strength of the weapon that Fedya can obtain from the given materials. In the first test case, the weapon made from materials wit'...

Tutorials

Codeforces Round #879 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
210187739 bluemegane B June 18, 2023, 10:26 p.m. OK C# 8 TESTS 8 108 409600
210187612 bluemegane B June 18, 2023, 10:23 p.m. OK C# 8 TESTS 8 124 716800
210164936 Segment_Treap B June 18, 2023, 4:34 p.m. OK Clang++17 Diagnostics TESTS 8 46 0
210181368 ayush_2318 B June 18, 2023, 7:51 p.m. OK Clang++17 Diagnostics TESTS 8 46 0
210101589 TaylorFly B June 18, 2023, 1:05 p.m. OK Clang++17 Diagnostics TESTS 8 46 1024000
210098916 swayingdream B June 18, 2023, 12:34 p.m. OK GNU C11 TESTS 8 15 0
210074430 ArthurTsai B June 18, 2023, 9:40 a.m. OK GNU C11 TESTS 7 15 0
210078840 Shivu_7 B June 18, 2023, 9:54 a.m. OK GNU C11 TESTS 7 30 0
210102705 akmeena22 B June 18, 2023, 1:19 p.m. OK GNU C11 TESTS 8 30 0
210084422 include_BM B June 18, 2023, 10:20 a.m. OK GNU C++14 TESTS 7 0 0
210077658 xuweihao1000 B June 18, 2023, 9:50 a.m. OK GNU C++14 TESTS 7 0 0
210087500 Bai_xiaobo B June 18, 2023, 10:40 a.m. OK GNU C++14 TESTS 7 0 0
210092482 ayush_n B June 18, 2023, 11:26 a.m. OK GNU C++14 TESTS 7 0 102400
210087539 XuHeiwangchao B June 18, 2023, 10:40 a.m. OK GNU C++14 TESTS 7 0 102400
210082787 Anil_24 B June 18, 2023, 10:04 a.m. OK GNU C++14 TESTS 7 0 102400
210075145 RANJAN888 B June 18, 2023, 9:43 a.m. OK GNU C++14 TESTS 7 0 102400
210102274 ajmal_mohad B June 18, 2023, 1:13 p.m. OK GNU C++14 TESTS 8 0 102400
210102505 shubhambhadada B June 18, 2023, 1:16 p.m. OK GNU C++14 TESTS 8 0 102400
210098503 broCoder07 B June 18, 2023, 12:29 p.m. OK GNU C++14 TESTS 8 0 102400
210174257 Hamza444 B June 18, 2023, 6:06 p.m. OK GNU C++17 TESTS 8 0 0
210100979 Gazyeyes B June 18, 2023, 12:58 p.m. OK GNU C++17 TESTS 8 0 0
210098996 ankit277 B June 18, 2023, 12:35 p.m. OK GNU C++17 TESTS 8 0 0
210097751 Aayush_Ad B June 18, 2023, 12:22 p.m. OK GNU C++17 TESTS 8 0 0
210097729 AayushAdlakha B June 18, 2023, 12:21 p.m. OK GNU C++17 TESTS 8 0 0
210092294 Youssif_Hassan B June 18, 2023, 11:25 a.m. OK GNU C++17 TESTS 7 0 0
210091691 __panda54 B June 18, 2023, 11:18 a.m. OK GNU C++17 TESTS 7 0 0
210192295 dlwc B June 19, 2023, 1:08 a.m. OK GNU C++17 TESTS 8 0 0
210190852 HarperTaylor B June 19, 2023, 12:22 a.m. OK GNU C++17 TESTS 8 0 0
210186252 Shahd_Mohamed230 B June 18, 2023, 9:41 p.m. OK GNU C++17 TESTS 8 0 0
210103017 HelmOptimum B June 18, 2023, 1:23 p.m. OK GNU C++17 (64) TESTS 8 0 0
210198900 ztl58553116 B June 19, 2023, 3:47 a.m. OK GNU C++17 (64) TESTS 8 0 0
210109421 _s_b_a_a B June 18, 2023, 2:30 p.m. OK GNU C++17 (64) TESTS 8 0 0
210109305 Atiqur_Rahman99 B June 18, 2023, 2:29 p.m. OK GNU C++17 (64) TESTS 8 0 0
210109269 MohmadZaid._. B June 18, 2023, 2:28 p.m. OK GNU C++17 (64) TESTS 8 0 0
210101704 nksrivastava18 B June 18, 2023, 1:06 p.m. OK GNU C++17 (64) TESTS 8 0 0
210099344 os-moussao B June 18, 2023, 12:39 p.m. OK GNU C++17 (64) TESTS 8 0 0
210093876 rmkgpian10052 B June 18, 2023, 11:41 a.m. OK GNU C++17 (64) TESTS 8 0 0
210092304 Mo7amed_Hossam B June 18, 2023, 11:25 a.m. OK GNU C++17 (64) TESTS 7 0 0
210091522 toniskrijelj B June 18, 2023, 11:16 a.m. OK GNU C++17 (64) TESTS 7 0 0
210204750 Harsh_45 B June 19, 2023, 5:36 a.m. OK GNU C++20 (64) TESTS 8 0 0
210204433 wzihan B June 19, 2023, 5:31 a.m. OK GNU C++20 (64) TESTS 8 0 0
210203923 rxhxn_30 B June 19, 2023, 5:22 a.m. OK GNU C++20 (64) TESTS 8 0 0
210202632 anuragkumar06243 B June 19, 2023, 4:58 a.m. OK GNU C++20 (64) TESTS 8 0 0
210201731 Sanginov B June 19, 2023, 4:40 a.m. OK GNU C++20 (64) TESTS 8 0 0
210201671 Kaisar_0 B June 19, 2023, 4:39 a.m. OK GNU C++20 (64) TESTS 8 0 0
210200380 vishalbiet B June 19, 2023, 4:10 a.m. OK GNU C++20 (64) TESTS 8 0 0
210204768 Sanath_Kulla B June 19, 2023, 5:36 a.m. OK GNU C++20 (64) TESTS 8 0 0
210204803 PraWater B June 19, 2023, 5:37 a.m. OK GNU C++20 (64) TESTS 8 0 0
210205369 dry_myrica B June 19, 2023, 5:46 a.m. OK GNU C++20 (64) TESTS 8 0 0
210194612 cck111 B June 19, 2023, 2:13 a.m. OK Go TESTS 8 15 204800
210074976 tanukool B June 18, 2023, 9:42 a.m. OK Java 11 TESTS 7 171 0
210165951 g_square B June 18, 2023, 4:41 p.m. OK Java 11 TESTS 8 171 0
210088730 ch2001 B June 18, 2023, 10:50 a.m. OK Java 11 TESTS 7 171 0
210150313 MuhammD_husss B June 18, 2023, 3:53 p.m. OK Java 11 TESTS 8 187 0
210150032 QianCCC B June 18, 2023, 3:52 p.m. OK Java 11 TESTS 8 202 0
210202655 LazyStack B June 19, 2023, 4:59 a.m. OK Java 11 TESTS 8 202 0
210090693 ashutoshchahar1250 B June 18, 2023, 11:08 a.m. OK Java 11 TESTS 7 202 0
210074715 ttannishh B June 18, 2023, 9:41 a.m. OK Java 11 TESTS 7 202 0
210077426 nihals.ug20.ee B June 18, 2023, 9:49 a.m. OK Java 11 TESTS 7 217 0
210097194 Bucky_ B June 18, 2023, 12:16 p.m. OK Java 11 TESTS 8 218 0
210085010 dakshkhullar14 B June 18, 2023, 10:23 a.m. OK Java 17 TESTS 7 139 204800
210075501 jimmyd211 B June 18, 2023, 9:44 a.m. OK Java 17 TESTS 7 171 204800
210086462 whd_CN B June 18, 2023, 10:32 a.m. OK Java 17 TESTS 7 186 0
210097091 wintersoldier2004 B June 18, 2023, 12:15 p.m. OK Java 17 TESTS 8 202 102400
210079267 fightingxjz B June 18, 2023, 9:55 a.m. OK Java 17 TESTS 7 202 204800
210075579 VIVEK_8877 B June 18, 2023, 9:44 a.m. OK Java 17 TESTS 7 202 409600
210181967 Black-Heart B June 18, 2023, 8:03 p.m. OK Java 17 TESTS 8 202 5632000
210074096 Vaibhav1mahajan B June 18, 2023, 9:39 a.m. OK Java 17 TESTS 7 217 512000
210085023 Suraj1607 B June 18, 2023, 10:23 a.m. OK Java 17 TESTS 7 217 716800
210074333 krishnakumar.211it034 B June 18, 2023, 9:40 a.m. OK Java 17 TESTS 7 218 204800
210089596 Koka B June 18, 2023, 10:58 a.m. OK Java 8 TESTS 7 92 0
210093031 priyaroy3370 B June 18, 2023, 11:32 a.m. OK Java 8 TESTS 8 93 0
210196072 yadavDipesh B June 19, 2023, 2:46 a.m. OK Java 8 TESTS 8 108 0
210086412 Sumitsingh7 B June 18, 2023, 10:32 a.m. OK Java 8 TESTS 7 109 5734400
210093390 Saurabh-Sharma B June 18, 2023, 11:37 a.m. OK Java 8 TESTS 8 124 0
210087877 summer_i B June 18, 2023, 10:42 a.m. OK Java 8 TESTS 7 124 0
210079449 TimeToAct1on B June 18, 2023, 9:56 a.m. OK Java 8 TESTS 7 124 0
210079240 r1cky B June 18, 2023, 9:55 a.m. OK Java 8 TESTS 7 124 0
210076479 lioeva_niuma B June 18, 2023, 9:47 a.m. OK Java 8 TESTS 7 124 0
210100775 depurador_ik B June 18, 2023, 12:56 p.m. OK Java 8 TESTS 8 124 38195200
210135373 SlavaG B June 18, 2023, 3:18 p.m. OK Kotlin 1.7 TESTS 8 311 307200
210076791 mkmsouti99 B June 18, 2023, 9:48 a.m. OK Kotlin 1.7 TESTS 7 374 512000
210100130 _vanger_ B June 18, 2023, 12:49 p.m. OK MS C++ 2017 TESTS 8 15 0
210096391 skimono B June 18, 2023, 12:07 p.m. OK MS C++ 2017 TESTS 8 15 0
210088623 NajlSadek B June 18, 2023, 10:49 a.m. OK MS C++ 2017 TESTS 7 15 0
210080152 dinex_cher B June 18, 2023, 9:58 a.m. OK MS C++ 2017 TESTS 7 15 0
210079584 CandidFlakes B June 18, 2023, 9:56 a.m. OK MS C++ 2017 TESTS 7 15 0
210075693 aygayuda B June 18, 2023, 9:44 a.m. OK MS C++ 2017 TESTS 7 15 0
210094464 EbuYandex B June 18, 2023, 11:48 a.m. OK MS C++ 2017 TESTS 8 30 0
210077699 mmcclure B June 18, 2023, 9:50 a.m. OK PyPy 3 TESTS 7 93 2252800
210152844 in_the_Air B June 18, 2023, 4 p.m. OK PyPy 3 TESTS 8 108 2150400
210098405 pennymagic156 B June 18, 2023, 12:28 p.m. OK PyPy 3 TESTS 8 109 1536000
210080332 mandalorian_p B June 18, 2023, 9:58 a.m. OK PyPy 3 TESTS 7 109 2560000
210093388 DHF_20 B June 18, 2023, 11:37 a.m. OK PyPy 3 TESTS 8 109 2764800
210204503 Fizinkaut B June 19, 2023, 5:32 a.m. OK PyPy 3 TESTS 8 124 2355200
210094313 jvatsal0709 B June 18, 2023, 11:46 a.m. OK PyPy 3 TESTS 8 124 2662400
210087336 44184005TuanNB B June 18, 2023, 10:38 a.m. OK PyPy 3 TESTS 7 124 3072000
210077360 Vashi B June 18, 2023, 9:49 a.m. OK PyPy 3 TESTS 7 140 2867200
210075975 shadowfieend B June 18, 2023, 9:45 a.m. OK PyPy 3 TESTS 7 140 2867200
210180912 gardengnome B June 18, 2023, 7:43 p.m. OK PyPy 3-64 TESTS 8 62 1638400
210184221 Michael_V B June 18, 2023, 8:46 p.m. OK PyPy 3-64 TESTS 8 62 1945600
210201461 momochi003 B June 19, 2023, 4:34 a.m. OK PyPy 3-64 TESTS 8 62 2150400
210187185 lpychemistry B June 18, 2023, 10:09 p.m. OK PyPy 3-64 TESTS 8 62 2252800
210145875 Alex239 B June 18, 2023, 3:42 p.m. OK PyPy 3-64 TESTS 8 62 2560000
210086713 gfriend1eunha B June 18, 2023, 10:34 a.m. OK PyPy 3-64 TESTS 7 77 1945600
210084554 khan_ali B June 18, 2023, 10:20 a.m. OK PyPy 3-64 TESTS 7 77 2048000
210080421 ankit_x B June 18, 2023, 9:59 a.m. OK PyPy 3-64 TESTS 7 77 2355200
210093521 nikolatesla999001 B June 18, 2023, 11:38 a.m. OK PyPy 3-64 TESTS 8 77 2867200
210200632 nealzane B June 19, 2023, 4:15 a.m. OK PyPy 3-64 TESTS 8 77 3379200
210086888 Hanle B June 18, 2023, 10:35 a.m. OK Python 3 TESTS 7 30 0
210175129 THEarchitect B June 18, 2023, 6:16 p.m. OK Python 3 TESTS 8 31 0
210109241 tedblackson B June 18, 2023, 2:28 p.m. OK Python 3 TESTS 8 31 0
210098733 BeanBurrito B June 18, 2023, 12:32 p.m. OK Python 3 TESTS 8 31 0
210096278 shashwat22473 B June 18, 2023, 12:06 p.m. OK Python 3 TESTS 8 31 0
210094485 brownfox2k6 B June 18, 2023, 11:48 a.m. OK Python 3 TESTS 8 31 0
210080631 Bottom_G B June 18, 2023, 9:59 a.m. OK Python 3 TESTS 7 31 0
210078924 abhishek_saggam B June 18, 2023, 9:54 a.m. OK Python 3 TESTS 7 31 0
210074566 siddhant4583agarwal B June 18, 2023, 9:41 a.m. OK Python 3 TESTS 7 31 0
210202782 AlokRoy_24 B June 19, 2023, 5:01 a.m. OK Python 3 TESTS 8 46 0
210108698 thirtiseven B June 18, 2023, 2:22 p.m. OK Scala TESTS 8 436 0

remove filters

Back to search problems