Codeforces Round 543 (Div. 1, based on Technocup 2019 Final Round)

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
1120 Codeforces Round 543 (Div. 1, based on Technocup 2019 Final Round) FINISHED False 7200 185811887 March 3, 2019, 3:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 434 ) B Once in a casino PROGRAMMING constructive algorithms greedy implementation math 2700

B'One player came to a casino and found a slot machine where everything depends only on how he plays. The rules follow. A positive integer a is initially on the screen. The player can put a coin into the machine and then add 1 to or subtract 1 from any two adjacent digits. All digits must remain from 0 to 9 after this operation, and the leading digit must not equal zero. In other words, it is forbidden to add 1 to 9 , to subtract 1 from 0 and to subtract 1 from the leading 1 . Once the number on the screen becomes equal to b , the player wins the jackpot. a and b have the same number of digits. Help the player to determine the minimal number of coins he needs to spend in order to win the jackpot and tell how to play. The first line contains a single integer n ( 2 <= n <= 10^5 ) standing for the length of numbers a and b . The next two lines contain numbers a and b , each one on a separate line ( 10^{n-1} <= a, b < 10^n ). If it is impossible to win the jackpot, print a single integer -1 . Otherwise, the first line must contain the minimal possible number c of coins the player has to spend. min(c, 10^5) lines should follow, i -th of them containing two integers d_i and s_i ( 1 <= d_i <= n - 1 , s_i = pm 1 ) denoting that on the i -th step the player should add s_i to the d_i -th and (d_i + 1) -st digits from the left (e. g. d_i = 1 means that two leading digits change while d_i = n - 1 means that there are two trailing digits which change). Please notice that the answer may be very big and in case c > 10^5 you should print only the first 10^5 moves. Your answer is considered correct if it is possible to finish your printed moves to win the jackpot in the minimal possible number of coins. In particular, if there are multiple ways to do this, you can outp'...

Tutorials

Разбор задач финала Технокубка 2019 и Codeforces Round #543

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
52572900 rainboy B April 10, 2019, 2:58 p.m. OK GNU C11 TESTS 92 358 2560000 2700
50998156 yukuai26 B March 8, 2019, 5:22 a.m. OK GNU C++11 TESTS 92 31 5222400 2700
52953468 Gaozijian B April 18, 2019, 12:50 p.m. OK GNU C++11 TESTS 92 46 614400 2700
50763759 JohnsonT B March 3, 2019, 9:31 p.m. OK GNU C++11 TESTS 92 46 1126400 2700
54151210 vjudge2 B May 15, 2019, 12:20 a.m. OK GNU C++11 TESTS 92 46 1228800 2700
54079573 Master_Yi B May 14, 2019, 1:21 a.m. OK GNU C++11 TESTS 92 46 1228800 2700
57866974 lopare B July 27, 2019, 9:48 p.m. OK GNU C++11 TESTS 92 46 1228800 2700
50886758 Panole233 B March 6, 2019, 11:38 a.m. OK GNU C++11 TESTS 92 46 1740800 2700
51297698 Big_black_jujube B March 14, 2019, 1:04 p.m. OK GNU C++11 TESTS 92 46 1740800 2700
50785614 dream_maker B March 4, 2019, 1:12 p.m. OK GNU C++11 TESTS 92 46 2048000 2700
69522182 geneanlyz B Jan. 25, 2020, 1:45 p.m. OK GNU C++11 TESTS 92 46 2048000 2700
51395593 860579 B March 17, 2019, 4:15 a.m. OK GNU C++14 TESTS 92 46 1536000 2700
52935696 htnhtn B April 18, 2019, 6:16 a.m. OK GNU C++14 TESTS 92 46 1638400 2700
50755398 lumibons B March 3, 2019, 5:15 p.m. OK GNU C++14 TESTS 92 46 2048000 2700
51204062 zsyzsy B March 12, 2019, 3:10 a.m. OK GNU C++14 TESTS 92 46 2150400 2700
50754599 natsugiri B March 3, 2019, 5:06 p.m. OK GNU C++14 TESTS 92 46 2355200 2700
50772545 fshp971 B March 4, 2019, 6:04 a.m. OK GNU C++14 TESTS 92 46 2969600 2700
50772573 fshp971 B March 4, 2019, 6:06 a.m. OK GNU C++14 TESTS 92 46 2969600 2700
51004275 thjchph4trjnh B March 8, 2019, 8:32 a.m. OK GNU C++14 TESTS 92 46 4403200 2700
51004366 chemthan B March 8, 2019, 8:35 a.m. OK GNU C++14 TESTS 92 46 4403200 2700
68996072 yan-zp B Jan. 17, 2020, 5:26 p.m. OK GNU C++14 TESTS 92 46 4915200 2700
50798950 danielfleischman B March 4, 2019, 8:53 p.m. OK GNU C++17 TESTS 92 46 204800 2700
68127490 user202729_ B Jan. 3, 2020, 3:44 p.m. OK GNU C++17 TESTS 92 46 614400 2700
52467204 pkgunboat B April 7, 2019, 4:22 p.m. OK GNU C++17 TESTS 92 46 1331200 2700
55527359 Fulisike B June 13, 2019, 11:50 a.m. OK GNU C++17 TESTS 92 46 2150400 2700
50751146 al13n B March 3, 2019, 4:32 p.m. OK GNU C++17 TESTS 92 46 2252800 2700
52295414 Zhangks B April 4, 2019, 5:48 a.m. OK GNU C++17 TESTS 92 46 2867200 2700
50805878 JiangYutong B March 5, 2019, 5:25 a.m. OK GNU C++17 TESTS 92 46 2969600 2700
56421895 nikutto B July 2, 2019, 7:44 a.m. OK GNU C++17 TESTS 92 46 3276800 2700
50841677 OneirdyniaYi B March 5, 2019, 4:01 p.m. OK GNU C++17 TESTS 92 46 3276800 2700
51260818 hznu_kk B March 13, 2019, 1:15 p.m. OK GNU C++17 TESTS 92 46 3686400 2700
51050216 beroul B March 8, 2019, 8:37 p.m. OK Java 8 TESTS 92 140 0 2700
52572899 Dukkha B April 10, 2019, 2:58 p.m. OK Java 8 TESTS 92 155 102400 2700
64909680 dalt B Nov. 15, 2019, 2:10 a.m. OK Java 8 TESTS 92 155 46387200 2700
51050323 beroul B March 8, 2019, 8:41 p.m. OK Java 8 TESTS 92 171 0 2700
51348601 insane_n00b pradeepdhankhar B March 15, 2019, 7:59 p.m. OK Java 8 TESTS 92 186 5017600 2700
50903391 Jeel_Vaishnav B March 6, 2019, 6:35 p.m. OK Java 8 TESTS 92 186 5017600 2700
50755411 pajenegod B March 3, 2019, 5:15 p.m. OK PyPy 2 TESTS 92 233 18944000 2700
51264489 gerw B March 13, 2019, 2:52 p.m. OK Python 3 TESTS 92 623 4608000 2700

remove filters

Back to search problems