Codeforces Round 856 (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
1794 Codeforces Round 856 (Div. 2) FINISHED False 7200 53871899 March 4, 2023, 5:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 23095 ) B Not Dividing PROGRAMMING constructive algorithms greedy math

B"You are given an array of n positive integers a_1, a_2, ldots, a_n . In one operation, you can choose any number of the array and add 1 to it. Make at most 2n operations so that the array satisfies the following property: a_{i+1} is not divisible by a_i , for each i = 1, 2, ldots, n-1 . 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 <= 10^4 ). The description of the test cases follows. The first line of each test case contains an integer n ( 1 <= n <= 10^4 ) -- the length of the given array. The second line of each test case contains n integers a_1,a_2, ldots,a_n ( 1 <= a_i <= q 10^9 ) -- the given array. It is guaranteed that the sum of n over all test cases does not exceed 5 cdot 10^4 . For each test case, print the answer on a separate line. In the only line, print n integers -- the resulting array a after applying at most 2n operations. We can show that an answer always exists under the given constraints. If there are multiple answers, print any of them. In the first test case, the array [4, 5, 6, 7] can be achieved by applying 2 operations to the first element, 1 operation to the second element, 3 operations to the third element, and 1 operation to the last element. The total number of operations performed is 7 , which is less than the allowed 8 operations in this case. In the second test case, the array [3, 2, 3] can be achieved by applying two operations to the first element. Another possible resulting array could be [2, 3, 5] , because the total number of operations does not need to be minimum. In the third test case, not applying any operations results in an array that satisfies the statement's property. Observe that it is not mandatory to make operations. "...

Tutorials

Codeforces Round 856 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
196064786 PavolKoman B March 4, 2023, 9:05 p.m. OK C# 10 TESTS 30 77 5529600
196043454 sotiredofyours B March 4, 2023, 6:56 p.m. OK C# 10 TESTS 30 92 6144000
196047204 Max1Mcg B March 4, 2023, 7:07 p.m. OK C# 10 TESTS 30 202 7168000
196080104 2507544221 B March 5, 2023, 2:49 a.m. OK Clang++20 Diagnostics TESTS 30 436 10547200
196086827 djzoo B March 5, 2023, 4:57 a.m. OK GNU C++14 TESTS 30 31 0
196082265 gjx B March 5, 2023, 3:37 a.m. OK GNU C++14 TESTS 30 31 0
196081671 ling_yun B March 5, 2023, 3:24 a.m. OK GNU C++14 TESTS 30 31 0
196077102 Xanadu13 B March 5, 2023, 1:37 a.m. OK GNU C++14 TESTS 30 31 0
196071047 chfrn B March 4, 2023, 10:42 p.m. OK GNU C++14 TESTS 30 31 0
196059692 mohamed__anwar B March 4, 2023, 8:18 p.m. OK GNU C++14 TESTS 30 31 0
196054856 Leo_W B March 4, 2023, 7:32 p.m. OK GNU C++14 TESTS 30 31 0
196087001 IceMocheJian B March 5, 2023, 5 a.m. OK GNU C++14 TESTS 30 31 102400
196086570 yash2723 B March 5, 2023, 4:53 a.m. OK GNU C++14 TESTS 30 31 102400
196082465 MuranSama B March 5, 2023, 3:41 a.m. OK GNU C++14 TESTS 30 31 102400

remove filters

Back to search problems