Codeforces Round 542 [Alex Lopashev Thanks-Round] (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
1129 Codeforces Round 542 [Alex Lopashev Thanks-Round] (Div. 1) FINISHED False 7200 180800699 Feb. 24, 2019, 3:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2210 ) B Wrong Answer PROGRAMMING constructive algorithms 2200

B'Consider the following problem: given an array a containing n integers (indexed from 0 to n-1 ), find max limits_{0 <= q l <= q r <= q n-1} sum limits_{l <= q i <= q r} (r-l+1) cdot a_i . In this problem, 1 <= q n <= q 2 ,000 and |a_i| <= q 10^6 . In an attempt to solve the problem described, Alice quickly came up with a blazing-fast greedy algorithm and coded it. Her implementation in pseudocode is as follows: Also, as you can see, Alice 's idea is not entirely correct. For example, suppose n = 4 and a = [6, -8, 7, -42] . Then, find_answer(n, a) would return 7 , but the correct answer is 3 cdot (6-8+7) = 15 . You told Alice that her solution is incorrect, but she did not believe what you said. Given an integer k , you are to find any sequence a of n integers such that the correct answer and the answer produced by Alice 's algorithm differ by exactly k . Note that although the choice of n and the content of the sequence is yours, you must still follow the constraints earlier given: that 1 <= q n <= q 2 ,000 and that the absolute value of each element does not exceed 10^6 . If there is no such sequence, determine so. The first and only line contains one integer k ( 1 <= q k <= q 10^9 ). If there is no sought sequence, print "-1". Otherwise, in the first line, print one integer n ( 1 <= q n <= q 2 ,000 ), denoting the number of elements in the sequence. Then, in the second line, print n space-separated integers: a_0, a_1, ldots, a_{n-1} ( |a_i| <= q 10^6 ). The first sample corresponds to the example given in the problem statement. In the second sample, one answer is n = 7 with a = [30, -12, -99, 123, -2, 245, -300] , in which case find_answer(n, a) returns 1098 , while the correct answer is 1710 . '...

Tutorials

65520

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
50447662 hos.lyric B Feb. 24, 2019, 4:20 p.m. OK D TESTS 75 31 4403200 2200
50550923 PhuongPeu B Feb. 27, 2019, 4:12 a.m. OK FPC TESTS 75 46 307200 2200
50452208 rainboy B Feb. 24, 2019, 4:45 p.m. OK GNU C11 TESTS 75 46 0 2200
61988342 vjudge1 B Oct. 6, 2019, 2:17 p.m. OK GNU C++11 TESTS 75 30 0 2200
66481824 liuweih B Dec. 8, 2019, 3:27 a.m. OK GNU C++11 TESTS 75 31 0 2200
66317195 luogu_bot2 B Dec. 5, 2019, 1:22 p.m. OK GNU C++11 TESTS 75 31 0 2200
68742829 geneanlyz B Jan. 14, 2020, 2:32 a.m. OK GNU C++11 TESTS 75 31 0 2200
67495652 Phoom B Dec. 23, 2019, 10:28 p.m. OK GNU C++11 TESTS 75 31 0 2200
64626149 __Salty__ B Nov. 10, 2019, 8:35 a.m. OK GNU C++11 TESTS 75 31 0 2200
64462071 GJC_xj B Nov. 7, 2019, 10:43 a.m. OK GNU C++11 TESTS 75 31 0 2200
62547664 ChthollyTree B Oct. 14, 2019, 7:10 a.m. OK GNU C++11 TESTS 75 31 0 2200
65713097 CoolBANGstone B Nov. 25, 2019, 3:14 p.m. OK GNU C++11 TESTS 75 31 0 2200
66571506 F-Mu B Dec. 10, 2019, 4:53 a.m. OK GNU C++11 TESTS 75 31 0 2200
50512832 bibibibi B Feb. 26, 2019, 3:10 a.m. OK GNU C++14 TESTS 75 30 0 2200
53012987 ACRush B April 19, 2019, 12:56 p.m. OK GNU C++14 TESTS 75 30 0 2200
51823613 EulerLee B March 25, 2019, 1:07 p.m. OK GNU C++14 TESTS 75 30 0 2200
51060598 Sunflash B March 9, 2019, 2:40 a.m. OK GNU C++14 TESTS 75 30 0 2200
50779813 Jian_Ron B March 4, 2019, 10:48 a.m. OK GNU C++14 TESTS 75 30 0 2200
50768797 everlasting B March 4, 2019, 2:01 a.m. OK GNU C++14 TESTS 75 30 0 2200
50560654 ddolgu14 B Feb. 27, 2019, 10:50 a.m. OK GNU C++14 TESTS 75 30 0 2200
50554235 gtrhetr B Feb. 27, 2019, 6:57 a.m. OK GNU C++14 TESTS 75 30 0 2200
50494472 AgReB B Feb. 25, 2019, 2:36 p.m. OK GNU C++14 TESTS 75 30 0 2200
50472643 -dreamland- B Feb. 25, 2019, 2:50 a.m. OK GNU C++14 TESTS 75 30 0 2200
58105973 1509cxt B Aug. 1, 2019, 4:18 a.m. OK GNU C++17 TESTS 75 15 0 2200
50810693 shenyunhan B March 5, 2019, 8:36 a.m. OK GNU C++17 TESTS 75 30 0 2200
50585261 stArliGht B Feb. 28, 2019, 2:52 a.m. OK GNU C++17 TESTS 75 30 0 2200
50557851 kamrul_s B Feb. 27, 2019, 9:06 a.m. OK GNU C++17 TESTS 75 30 0 2200
50510659 lmiskiew B Feb. 25, 2019, 11:56 p.m. OK GNU C++17 TESTS 75 30 0 2200
50491822 AndresRPerez B Feb. 25, 2019, 1:36 p.m. OK GNU C++17 TESTS 75 30 0 2200
50480347 klimmek55 B Feb. 25, 2019, 8:37 a.m. OK GNU C++17 TESTS 75 30 0 2200
50457739 mohamedeltair B Feb. 24, 2019, 5:18 p.m. OK GNU C++17 TESTS 75 30 0 2200
50455037 Eva B Feb. 24, 2019, 5:02 p.m. OK GNU C++17 TESTS 75 30 0 2200
58164992 vjudge5 B Aug. 2, 2019, 8:44 a.m. OK GNU C++17 TESTS 75 30 0 2200
61266434 vjudge4 B Sept. 25, 2019, 12:53 p.m. OK Go TESTS 75 46 0 2200
61266270 WangJialei B Sept. 25, 2019, 12:50 p.m. OK Go TESTS 75 46 0 2200
52368309 cylixstar B April 6, 2019, 4:10 a.m. OK Haskell TESTS 75 46 102400 2200
59543023 beginner1010 B Aug. 26, 2019, 7:53 p.m. OK Java 8 TESTS 75 109 0 2200
51071108 Omar_Morsi B March 9, 2019, 7:41 a.m. OK Java 8 TESTS 75 109 0 2200
65506231 ijxjdjd B Nov. 21, 2019, 10:52 p.m. OK Java 8 TESTS 75 124 0 2200
59543091 beginner1010 B Aug. 26, 2019, 7:55 p.m. OK Java 8 TESTS 75 124 0 2200
52546461 beroul B April 9, 2019, 10:02 p.m. OK Java 8 TESTS 75 124 0 2200
50552035 Ahmad B Feb. 27, 2019, 5:20 a.m. OK Java 8 TESTS 75 124 0 2200
50499957 tmwilliamlin168 B Feb. 25, 2019, 4:48 p.m. OK Java 8 TESTS 75 124 0 2200
50467177 liymbear B Feb. 24, 2019, 8:35 p.m. OK Java 8 TESTS 75 124 0 2200
50467006 liymbear B Feb. 24, 2019, 8:28 p.m. OK Java 8 TESTS 75 124 0 2200
50466586 liymbear B Feb. 24, 2019, 8:12 p.m. OK Java 8 TESTS 75 124 0 2200
50455928 riantkb B Feb. 24, 2019, 5:07 p.m. OK Mono C# TESTS 75 62 0 2200
50449144 BaturaDima B Feb. 24, 2019, 4:28 p.m. OK MS C++ TESTS 75 31 0 2200
50704670 cuihongbin B March 3, 2019, 2:38 a.m. OK MS C++ TESTS 75 31 0 2200
52628148 vjudge4 B April 12, 2019, 5:18 a.m. OK MS C++ TESTS 75 31 0 2200
62413934 vjudge2 B Oct. 12, 2019, 11:05 a.m. OK MS C++ TESTS 75 46 0 2200
50581732 petko_mitkov B Feb. 27, 2019, 10:07 p.m. OK MS C++ 2017 TESTS 75 31 0 2200
50470646 Friska B Feb. 25, 2019, 12:02 a.m. OK MS C++ 2017 TESTS 75 31 0 2200
50459374 xtalclr B Feb. 24, 2019, 5:27 p.m. OK MS C++ 2017 TESTS 75 31 0 2200
51434547 hld67890 B March 18, 2019, 5:16 a.m. OK MS C++ 2017 TESTS 75 31 102400 2200
50458984 aeremin B Feb. 24, 2019, 5:25 p.m. OK MS C++ 2017 TESTS 75 31 102400 2200
50472625 codeseeker B Feb. 25, 2019, 2:49 a.m. OK PyPy 2 TESTS 75 124 0 2200
50736138 Hokage777 B March 3, 2019, 1 p.m. OK PyPy 2 TESTS 75 233 409600 2200
50467140 pajenegod B Feb. 24, 2019, 8:33 p.m. OK PyPy 3 TESTS 75 139 204800 2200
50443128 --d B Feb. 24, 2019, 4:02 p.m. OK PyPy 3 TESTS 75 140 0 2200
53711699 pajenegod B May 3, 2019, 4 p.m. OK PyPy 3 TESTS 75 140 921600 2200
63708148 SinKing B Oct. 29, 2019, 9:05 a.m. OK PyPy 3 TESTS 75 140 1433600 2200
50736194 Hokage777 B March 3, 2019, 1:01 p.m. OK PyPy 3 TESTS 75 155 204800 2200
65713270 HanaYukii B Nov. 25, 2019, 3:19 p.m. OK PyPy 3 TESTS 75 155 1433600 2200
53711680 pajenegod B May 3, 2019, 3:59 p.m. OK PyPy 3 TESTS 75 156 921600 2200
50464533 LordVoldebug B Feb. 24, 2019, 7:11 p.m. OK PyPy 3 TESTS 75 156 921600 2200
50674992 HatsuneMikuo B March 2, 2019, 8:51 a.m. OK PyPy 3 TESTS 75 171 1536000 2200
50474637 Neil B Feb. 25, 2019, 4:57 a.m. OK Python 2 TESTS 75 202 307200 2200
50457267 Neil B Feb. 24, 2019, 5:15 p.m. OK Python 2 TESTS 75 202 307200 2200
50494621 algmyr B Feb. 25, 2019, 2:40 p.m. OK Python 3 TESTS 75 109 102400 2200
50466945 pajenegod B Feb. 24, 2019, 8:26 p.m. OK Python 3 TESTS 75 109 102400 2200
50452240 sonya123 B Feb. 24, 2019, 4:45 p.m. OK Python 3 TESTS 75 109 409600 2200
50458685 evenharder B Feb. 24, 2019, 5:24 p.m. OK Python 3 TESTS 75 124 102400 2200
50500627 tikul B Feb. 25, 2019, 5:05 p.m. OK Python 3 TESTS 75 124 512000 2200
50447614 whatshisbucket B Feb. 24, 2019, 4:20 p.m. OK Python 3 TESTS 75 139 307200 2200
50734115 Hokage777 B March 3, 2019, 12:10 p.m. OK Python 3 TESTS 75 280 307200 2200

remove filters

Back to search problems