Codeforces Round 889 (Div. 1)

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
1854 Codeforces Round 889 (Div. 1) FINISHED False 9000 41181899 July 29, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 7070 ) A2 Dual (Hard Version) PROGRAMMING constructive algorithms math

B'The only difference between the two versions of this problem is the constraint on the maximum number of operations. You can make hacks only if all versions of the problem are solved. You are given an array a_1, a_2, ... , a_n of integers (positive, negative or 0 ). You can perform multiple operations on the array (possibly 0 operations). In one operation, you choose i, j ( 1 <= q i, j <= q n , they can be equal) and set a_i := a_i + a_j (i.e., add a_j to a_i ). Make the array non-decreasing (i.e., a_i <= q a_{i+1} for 1 <= q i <= q n-1 ) in at most 31 operations. You do not need to minimize the number of operations. 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 contains a single integer n ( 1 <= n <= 20 ) -- the length of the array. The second line contains n integers a_1, a_2, ldots, a_n ( -20 <= a_i <= 20 ) -- the array before performing the operations. For each test case, output your operations in the following format. The first line should contain an integer k ( 0 <= k <= 31 ) -- the number of operations. The next k lines represent the k operations in order. Each of these k lines should contain two integers i and j ( 1 <= q i, j <= q n ) -- the corresponding operation consists in adding a_j to a_i . After all the operations, the array a_1, a_2, ... , a_n must be non-decreasing. In the first test case, by adding a_1 = 2 to a_2 , we get the array [2, 3] which is non-decreasing. In the second test case, the array changes as: In the third test case, the final array is [2, 3, 3, 3, 3] . '...

Tutorials

Editorial of Codeforces Round 889 (Div. 1 + Div. 2)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
216264970 KumaTachiRen A2 July 29, 2023, 3:04 p.m. OK C# 8 TESTS 4 93 2867200
216347156 hos.lyric A2 July 29, 2023, 5:55 p.m. OK D TESTS 5 15 0
216291988 Gassa A2 July 29, 2023, 3:43 p.m. OK D TESTS 4 15 204800
216272561 chro4896 A2 July 29, 2023, 3:15 p.m. OK GNU C11 TESTS 4 46 0
216384812 llloserqz A2 July 30, 2023, 2:13 a.m. OK GNU C++14 TESTS 5 0 0
216379625 Asbable A2 July 30, 2023, 12:35 a.m. OK GNU C++14 TESTS 5 0 0
216335447 Changyu A2 July 29, 2023, 4:57 p.m. OK GNU C++14 TESTS 4 0 0
216328682 Const_int A2 July 29, 2023, 4:45 p.m. OK GNU C++14 TESTS 4 0 0
216321532 Tom66 A2 July 29, 2023, 4:31 p.m. OK GNU C++14 TESTS 4 0 0
216308236 Dilute A2 July 29, 2023, 4:08 p.m. OK GNU C++14 TESTS 4 0 0
216272171 by_chance A2 July 29, 2023, 3:14 p.m. OK GNU C++14 TESTS 4 0 0
216272068 Sparkle_ZH A2 July 29, 2023, 3:14 p.m. OK GNU C++14 TESTS 4 0 0
216387626 ldh081122 A2 July 30, 2023, 2:58 a.m. OK GNU C++14 TESTS 5 0 0
216388759 Shui_Dream A2 July 30, 2023, 3:17 a.m. OK GNU C++14 TESTS 5 0 0
216392256 OTFSN_z_tfset A2 July 30, 2023, 4:08 a.m. OK GNU C++17 TESTS 5 0 0
216374465 SoundWave A2 July 29, 2023, 10:30 p.m. OK GNU C++17 TESTS 5 0 0
216348622 KroosTheKeenGlint A2 July 29, 2023, 6:02 p.m. OK GNU C++17 TESTS 5 0 0
216345768 znstz_2210QaQ A2 July 29, 2023, 5:49 p.m. OK GNU C++17 TESTS 5 0 0
216337172 gzchenben A2 July 29, 2023, 4:59 p.m. OK GNU C++17 TESTS 4 0 0
216318431 foammm A2 July 29, 2023, 4:26 p.m. OK GNU C++17 TESTS 4 0 0
216314662 stepsys A2 July 29, 2023, 4:19 p.m. OK GNU C++17 TESTS 4 0 0
216311789 LTL_td A2 July 29, 2023, 4:14 p.m. OK GNU C++17 TESTS 4 0 0
216299211 lxhgww A2 July 29, 2023, 3:54 p.m. OK GNU C++17 TESTS 4 0 0
216395366 razoncdr A2 July 30, 2023, 4:48 a.m. OK GNU C++17 TESTS 5 0 0
216386726 wsyear A2 July 30, 2023, 2:43 a.m. OK GNU C++17 (64) TESTS 5 0 0
216380789 Honey_Badger A2 July 30, 2023, 1:01 a.m. OK GNU C++17 (64) TESTS 5 0 0
216374517 stevenkplus A2 July 29, 2023, 10:30 p.m. OK GNU C++17 (64) TESTS 5 0 0
216365343 neal A2 July 29, 2023, 8:26 p.m. OK GNU C++17 (64) TESTS 5 0 0
216355179 TheLostCookie A2 July 29, 2023, 6:48 p.m. OK GNU C++17 (64) TESTS 5 0 0
216352073 lh3k A2 July 29, 2023, 6:24 p.m. OK GNU C++17 (64) TESTS 5 0 0
216349768 stan23456 A2 July 29, 2023, 6:09 p.m. OK GNU C++17 (64) TESTS 5 0 0
216335747 yangjl A2 July 29, 2023, 4:57 p.m. OK GNU C++17 (64) TESTS 4 0 0
216326692 SyruLoveNewTechnology A2 July 29, 2023, 4:41 p.m. OK GNU C++17 (64) TESTS 4 0 0
216388040 GoogleBot A2 July 30, 2023, 3:05 a.m. OK GNU C++17 (64) TESTS 5 0 0
216392142 JYJin A2 July 30, 2023, 4:06 a.m. OK GNU C++20 (64) TESTS 5 0 0
216401747 lquo A2 July 30, 2023, 6:02 a.m. OK GNU C++20 (64) TESTS 5 0 0
216394247 wwwyq07 A2 July 30, 2023, 4:34 a.m. OK GNU C++20 (64) TESTS 5 0 0
216393331 Fan_zf A2 July 30, 2023, 4:22 a.m. OK GNU C++20 (64) TESTS 5 0 0
216392458 jiuzheba A2 July 30, 2023, 4:10 a.m. OK GNU C++20 (64) TESTS 5 0 0
216390406 __jk__ A2 July 30, 2023, 3:41 a.m. OK GNU C++20 (64) TESTS 5 0 0
216389743 woonder A2 July 30, 2023, 3:31 a.m. OK GNU C++20 (64) TESTS 5 0 0
216389594 nor A2 July 30, 2023, 3:29 a.m. OK GNU C++20 (64) TESTS 5 0 0
216386043 orange_rain A2 July 30, 2023, 2:32 a.m. OK GNU C++20 (64) TESTS 5 0 0
216386040 atusha___ A2 July 30, 2023, 2:32 a.m. OK GNU C++20 (64) TESTS 5 0 0
216291543 profchi A2 July 29, 2023, 3:42 p.m. OK Java 11 TESTS 4 186 0
216311877 FierteDeCeylan A2 July 29, 2023, 4:14 p.m. OK Java 11 TESTS 4 202 0
216356329 kasiru_69 A2 July 29, 2023, 6:58 p.m. OK Java 11 TESTS 5 249 0
216266295 lemon_codes A2 July 29, 2023, 3:06 p.m. OK Java 17 TESTS 4 202 102400
216393760 JavaGodPeter A2 July 30, 2023, 4:28 a.m. OK Java 17 TESTS 5 295 1024000
216284708 yvbf A2 July 29, 2023, 3:32 p.m. OK Java 8 TESTS 4 93 0
216269650 golions A2 July 29, 2023, 3:11 p.m. OK Java 8 TESTS 4 93 0
216293698 cc4414 A2 July 29, 2023, 3:45 p.m. OK Java 8 TESTS 4 108 0
216334271 SecondThread A2 July 29, 2023, 4:55 p.m. OK Java 8 TESTS 4 109 38297600
216398685 formidablechief_27 A2 July 30, 2023, 5:28 a.m. OK Java 8 TESTS 5 124 0
216299885 RMA-NB A2 July 29, 2023, 3:55 p.m. OK Java 8 TESTS 4 140 0
216271186 Tlatoani A2 July 29, 2023, 3:13 p.m. OK Kotlin 1.6 TESTS 4 249 0
216308654 misorin A2 July 29, 2023, 4:09 p.m. OK PyPy 3 TESTS 4 124 2048000
216347718 hxu10 A2 July 29, 2023, 5:58 p.m. OK PyPy 3 TESTS 5 155 4198400
216299431 Kita A2 July 29, 2023, 3:54 p.m. OK PyPy 3-64 TESTS 4 93 7680000
216279151 xxh1999 A2 July 29, 2023, 3:24 p.m. OK PyPy 3-64 TESTS 4 108 10547200
216348886 sgybgm A2 July 29, 2023, 6:04 p.m. OK PyPy 3-64 TESTS 5 109 4505600
216333878 szjlove A2 July 29, 2023, 4:54 p.m. OK PyPy 3-64 TESTS 4 109 6246400
216276352 Mukundan314 A2 July 29, 2023, 3:20 p.m. OK PyPy 3-64 TESTS 4 109 6451200
216285964 codicon A2 July 29, 2023, 3:34 p.m. OK PyPy 3-64 TESTS 4 109 7577600
216383209 little_young A2 July 30, 2023, 1:46 a.m. OK PyPy 3-64 TESTS 5 124 7577600
216354095 pedrosorio A2 July 29, 2023, 6:39 p.m. OK PyPy 3-64 TESTS 5 124 9011200
216288918 Alex239 A2 July 29, 2023, 3:38 p.m. OK PyPy 3-64 TESTS 4 124 9420800
216318199 chinerist A2 July 29, 2023, 4:25 p.m. OK PyPy 3-64 TESTS 4 124 9523200
216278074 Ritwin A2 July 29, 2023, 3:23 p.m. OK Python 3 TESTS 4 46 102400
216368753 tanishq2507 A2 July 29, 2023, 9:03 p.m. OK Python 3 TESTS 5 46 204800
216260536 sansen A2 July 29, 2023, 2:58 p.m. OK Rust 2021 TESTS 4 0 102400
216334166 m.cpp A2 July 29, 2023, 4:54 p.m. OK Rust 2021 TESTS 4 15 0
216278345 nairb A2 July 29, 2023, 3:23 p.m. OK Rust 2021 TESTS 4 46 0
216298937 andrey.m A2 July 29, 2023, 3:53 p.m. OK Rust 2021 TESTS 4 93 0

remove filters

Back to search problems