Codeforces Round 502 (in memory of Leopoldo Taravilse, Div. 1 + 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
1017 Codeforces Round 502 (in memory of Leopoldo Taravilse, Div. 1 + Div. 2) FINISHED False 9600 203788524 Aug. 8, 2018, 2:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 6068 ) C The Phone Number PROGRAMMING constructive algorithms greedy 1600

B'Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number! The only thing Mrs. Smith remembered was that any permutation of n can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband. The sequence of n integers is called a permutation if it contains all integers from 1 to n exactly once. The secret value of a phone number is defined as the sum of the length of the longest increasing subsequence (LIS) and length of the longest decreasing subsequence (LDS). A subsequence a_{i_1}, a_{i_2}, ldots, a_{i_k} where 1 <= q i_1 < i_2 < ldots < i_k <= q n is called increasing if a_{i_1} < a_{i_2} < a_{i_3} < ldots < a_{i_k} . If a_{i_1} > a_{i_2} > a_{i_3} > ldots > a_{i_k} , a subsequence is called decreasing. An increasing/decreasing subsequence is called longest if it has maximum length among all increasing/decreasing subsequences. For example, if there is a permutation [6, 4, 1, 7, 2, 3, 5] , LIS of this permutation will be [1, 2, 3, 5] , so the length of LIS is equal to 4 . LDS can be [6, 4, 1] , [6, 4, 2] , or [6, 4, 3] , so the length of LDS is 3 . Note, the lengths of LIS and LDS can be different. So please help Mrs. Smith to find a permutation that gives a minimum sum of lengths of LIS and LDS. The only line contains one integer n ( 1 <= n <= 10^5 ) -- the length of permutation that you need to build. Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. In the first sample, you can build a permutation [3, 4, 1, 2] . LIS is [3, 4] (or [1, 2] ), so the length of LIS is equal to 2 . LDS can be ony of [3, 1] , [4, 2] , [3, 2] , or [4, 1] . The length of LDS is also equal to 2 . The sum is equal to 4 . Note that [3, 4, 1, 2] is not the only permutation tha'...

Tutorials

Разбор (англ.)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
41686007 rr_ C Aug. 17, 2018, 2:11 p.m. OK D TESTS 36 46 4198400 1600
41413852 ia7ck C Aug. 10, 2018, 12:15 a.m. OK D TESTS 36 46 4198400 1600
69186914 hos.lyric C Jan. 20, 2020, 12:15 p.m. OK D TESTS 36 61 4198400 1600
41369082 PAG C Aug. 8, 2018, 4:34 p.m. OK Delphi TESTS 36 46 409600 1600
41375927 TShT C Aug. 8, 2018, 8:49 p.m. OK FPC TESTS 36 171 0 1600
41363775 PiMat C Aug. 8, 2018, 3:50 p.m. OK FPC TESTS 36 171 0 1600
41396265 AHTOH._. C Aug. 9, 2018, 11:19 a.m. OK FPC TESTS 36 186 0 1600
41669587 wushuhan C Aug. 17, 2018, 3:38 a.m. OK FPC TESTS 36 187 0 1600
41667884 wushuhan C Aug. 17, 2018, 1:49 a.m. OK FPC TESTS 36 187 0 1600
41409251 __ShaW C Aug. 9, 2018, 6:51 p.m. OK FPC TESTS 36 202 102400 1600
42224384 chinahhy C Aug. 29, 2018, 12:51 a.m. OK FPC TESTS 36 218 0 1600
41667947 wushuhan C Aug. 17, 2018, 1:53 a.m. OK FPC TESTS 36 218 0 1600
41404012 egg23333 C Aug. 9, 2018, 3:27 p.m. OK GNU C TESTS 36 31 0 1600
41400464 cyberlord C Aug. 9, 2018, 1:21 p.m. OK GNU C TESTS 36 31 0 1600
41425426 RenKai_Z C Aug. 10, 2018, 9:02 a.m. OK GNU C TESTS 36 31 307200 1600
41429868 kara42 C Aug. 10, 2018, 11:54 a.m. OK GNU C TESTS 36 46 0 1600
41373012 MYNAMEISSHARIFUL C Aug. 8, 2018, 6:39 p.m. OK GNU C TESTS 36 46 0 1600
41362512 aniket.shrimal C Aug. 8, 2018, 3:43 p.m. OK GNU C TESTS 36 46 0 1600
41423492 aaranjan6 C Aug. 10, 2018, 8:11 a.m. OK GNU C TESTS 36 46 307200 1600
41360844 newbieski C Aug. 8, 2018, 3:35 p.m. OK GNU C TESTS 36 46 819200 1600
41366393 test616.cpp C Aug. 8, 2018, 4:09 p.m. OK GNU C++ TESTS 36 30 1024000 1600
41622310 Z1154990071 C Aug. 15, 2018, 12:35 p.m. OK GNU C++ TESTS 36 31 0 1600
41620206 luogu_bot5 C Aug. 15, 2018, 11:38 a.m. OK GNU C++ TESTS 36 31 0 1600
41615224 ztz11 C Aug. 15, 2018, 8:42 a.m. OK GNU C++ TESTS 36 31 0 1600
41612523 SWHsz C Aug. 15, 2018, 7:16 a.m. OK GNU C++ TESTS 36 31 0 1600
41612468 ivanovcraft C Aug. 15, 2018, 7:14 a.m. OK GNU C++ TESTS 36 31 0 1600
41612392 ztz11 C Aug. 15, 2018, 7:12 a.m. OK GNU C++ TESTS 36 31 0 1600
41580369 QAQ1 C Aug. 14, 2018, 7:45 a.m. OK GNU C++ TESTS 36 31 0 1600
41541262 zhaotiensn C Aug. 12, 2018, 11:51 p.m. OK GNU C++ TESTS 36 31 0 1600
41469325 Guozhicheng C Aug. 11, 2018, 12:41 p.m. OK GNU C++ TESTS 36 31 0 1600
64645744 vjudge3 C Nov. 10, 2019, 2:53 p.m. OK GNU C11 TESTS 36 327 0 1600
41587300 great_influence C Aug. 14, 2018, 12:04 p.m. OK GNU C++11 TESTS 36 30 8499200 1600
53897771 SoiMae C May 9, 2019, 7:13 a.m. OK GNU C++11 TESTS 36 31 0 1600
69074095 luogu_bot1 C Jan. 19, 2020, 1:31 a.m. OK GNU C++11 TESTS 36 31 0 1600
64667444 vjudge4 C Nov. 11, 2019, 3:34 a.m. OK GNU C++11 TESTS 36 31 0 1600
64650706 vjudge2 C Nov. 10, 2019, 5:01 p.m. OK GNU C++11 TESTS 36 31 0 1600
64614005 vjudge2 C Nov. 10, 2019, 3:36 a.m. OK GNU C++11 TESTS 36 31 0 1600
64510014 vjudge1 C Nov. 8, 2019, 8:29 a.m. OK GNU C++11 TESTS 36 31 0 1600
64509903 vincy233 C Nov. 8, 2019, 8:26 a.m. OK GNU C++11 TESTS 36 31 0 1600
64503425 xhs7700 C Nov. 8, 2019, 5:38 a.m. OK GNU C++11 TESTS 36 31 0 1600
49502913 eason2012 C Feb. 5, 2019, 4:06 p.m. OK GNU C++11 TESTS 36 31 0 1600
41362395 1247 C Aug. 8, 2018, 3:43 p.m. OK GNU C++14 TESTS 36 30 10956800 1600
63651094 vjudge4 C Oct. 28, 2019, 11:24 a.m. OK GNU C++14 TESTS 36 31 0 1600
61953032 SoloProgrammer C Oct. 6, 2019, 4:37 a.m. OK GNU C++14 TESTS 36 31 0 1600
57946502 vladalos C July 29, 2019, 2:33 p.m. OK GNU C++14 TESTS 36 31 0 1600
54468342 lin972366831 C May 22, 2019, 2:46 a.m. OK GNU C++14 TESTS 36 31 0 1600
53768949 geezers C May 5, 2019, 3:14 a.m. OK GNU C++14 TESTS 36 31 0 1600
51434607 AC_007 C March 18, 2019, 5:19 a.m. OK GNU C++14 TESTS 36 31 0 1600
50639595 I_can_see_you C March 1, 2019, 1:22 p.m. OK GNU C++14 TESTS 36 31 0 1600
64665763 vjudge1 C Nov. 11, 2019, 2 a.m. OK GNU C++14 TESTS 36 31 0 1600
64360653 tanyifan C Nov. 6, 2019, 11:37 a.m. OK GNU C++14 TESTS 36 31 0 1600
42154380 rohanrko96.6 C Aug. 27, 2018, 1:51 p.m. OK GNU C++17 TESTS 36 30 204800 1600
65262769 Seyn C Nov. 17, 2019, 3:37 p.m. OK GNU C++17 TESTS 36 31 0 1600
64441929 vjudge2 C Nov. 7, 2019, 4:47 a.m. OK GNU C++17 TESTS 36 31 0 1600
55749655 Tom_Marvolo_Riddle C June 19, 2019, 12:02 p.m. OK GNU C++17 TESTS 36 31 0 1600
54497917 OrangE_3 C May 22, 2019, 6:47 p.m. OK GNU C++17 TESTS 36 31 0 1600
54468379 vjudge1 C May 22, 2019, 2:49 a.m. OK GNU C++17 TESTS 36 31 0 1600
53177415 JeuneEncore C April 23, 2019, 4:59 a.m. OK GNU C++17 TESTS 36 31 0 1600
52266469 Mogician_Jeff 1290852513 shadow217 C April 3, 2019, 11:34 a.m. OK GNU C++17 TESTS 36 31 0 1600
50523425 zz212088 C Feb. 26, 2019, 10:38 a.m. OK GNU C++17 TESTS 36 31 0 1600
47331865 Nikhil_Medam C Dec. 21, 2018, 1:18 p.m. OK GNU C++17 TESTS 36 31 0 1600
41377775 danielfleischman C Aug. 8, 2018, 11:02 p.m. OK Haskell TESTS 36 61 11776000 1600
41372194 umang._.panchal C Aug. 8, 2018, 6:13 p.m. OK Java 8 TESTS 36 124 0 1600
66877946 lazypanda C Dec. 14, 2019, 3:34 p.m. OK Java 8 TESTS 36 124 0 1600
60407395 StayAwayFromBitches C Sept. 11, 2019, 7:19 p.m. OK Java 8 TESTS 36 124 0 1600
50498730 mikkk C Feb. 25, 2019, 4:16 p.m. OK Java 8 TESTS 36 124 0 1600
46640893 kusomushi C Dec. 5, 2018, 9:35 a.m. OK Java 8 TESTS 36 124 0 1600
44098609 donli C Oct. 11, 2018, 3:50 a.m. OK Java 8 TESTS 36 124 0 1600
41402392 golions C Aug. 9, 2018, 2:27 p.m. OK Java 8 TESTS 36 124 0 1600
41375304 isku C Aug. 8, 2018, 8:12 p.m. OK Java 8 TESTS 36 124 0 1600
41397629 ZeyadKhattab C Aug. 9, 2018, 11:58 a.m. OK Java 8 TESTS 36 139 0 1600
41376865 PrakharJain C Aug. 8, 2018, 9:44 p.m. OK Java 8 TESTS 36 139 0 1600
56157193 og.kostya C June 27, 2019, 10:46 a.m. OK Mono C# TESTS 36 77 4403200 1600
51978992 nemars C March 29, 2019, 3:29 p.m. OK Mono C# TESTS 36 93 10649600 1600
41572083 jainchethan87 C Aug. 13, 2018, 11:25 p.m. OK Mono C# TESTS 36 249 3072000 1600
41753124 chkhetiani C Aug. 18, 2018, 10:38 a.m. OK Mono C# TESTS 36 280 3072000 1600
41474175 greenkirill C Aug. 11, 2018, 1:48 p.m. OK Mono C# TESTS 36 280 3072000 1600
41358603 Mickey-snow C Aug. 8, 2018, 3:26 p.m. OK Mono C# TESTS 36 295 3072000 1600
41413164 nhakhoa C Aug. 9, 2018, 10:43 p.m. OK MS C++ TESTS 36 31 0 1600
43816408 icearbiter C Oct. 5, 2018, 5:36 a.m. OK MS C++ TESTS 36 31 307200 1600
65662135 vjudge1 C Nov. 24, 2019, 12:48 p.m. OK MS C++ TESTS 36 31 409600 1600
42013166 yuxiaowen C Aug. 24, 2018, 3:35 a.m. OK MS C++ TESTS 36 46 0 1600
41822341 WyldeCat C Aug. 19, 2018, 10:14 a.m. OK MS C++ TESTS 36 46 0 1600
41429103 CrashMaster C Aug. 10, 2018, 11:24 a.m. OK MS C++ TESTS 36 46 0 1600
41369574 NateRiverxkh C Aug. 8, 2018, 4:39 p.m. OK MS C++ TESTS 36 46 0 1600
64526871 vjudge5 C Nov. 8, 2019, 2:04 p.m. OK MS C++ TESTS 36 46 409600 1600
44278067 LoneFox C Oct. 14, 2018, 12:41 a.m. OK MS C++ TESTS 36 46 614400 1600
41371338 youx C Aug. 8, 2018, 5:47 p.m. OK MS C++ TESTS 36 46 1433600 1600
63902045 shebao C Oct. 31, 2019, 5:05 a.m. OK MS C++ 2017 TESTS 36 46 409600 1600
64629510 HatsuneHan C Nov. 10, 2019, 9:39 a.m. OK MS C++ 2017 TESTS 36 62 0 1600
64629623 vjudge3 C Nov. 10, 2019, 9:42 a.m. OK MS C++ 2017 TESTS 36 62 0 1600
64503323 vjudge1 C Nov. 8, 2019, 5:35 a.m. OK MS C++ 2017 TESTS 36 62 409600 1600
64533774 vjudge4 C Nov. 8, 2019, 4:18 p.m. OK MS C++ 2017 TESTS 36 62 409600 1600
64555064 MisakiMikoto C Nov. 9, 2019, 3:03 a.m. OK MS C++ 2017 TESTS 36 77 307200 1600
49495881 PavelChadnov C Feb. 5, 2019, 12:49 p.m. OK MS C++ 2017 TESTS 36 78 0 1600
64375568 vjudge5 C Nov. 6, 2019, 3:11 p.m. OK MS C++ 2017 TESTS 36 78 716800 1600
59053649 Still_Theory C Aug. 18, 2019, 6:07 p.m. OK MS C++ 2017 TESTS 36 78 1024000 1600
64373731 vjudge3 C Nov. 6, 2019, 3:08 p.m. OK MS C++ 2017 TESTS 36 93 409600 1600
41357324 vudduu C Aug. 8, 2018, 3:21 p.m. OK Node.js TESTS 36 202 6963200 1600
46124721 mayakin C Nov. 23, 2018, 6:23 p.m. OK PHP TESTS 36 62 4198400 1600
41456753 kd710306 C Aug. 11, 2018, 6:46 a.m. OK PyPy 2 TESTS 36 140 2764800 1600
41442453 kakkarotssj C Aug. 10, 2018, 7:36 p.m. OK PyPy 2 TESTS 36 155 7987200 1600
41619220 abhigyank C Aug. 15, 2018, 11:09 a.m. OK PyPy 2 TESTS 36 810 716800 1600
41376323 pavankatta C Aug. 8, 2018, 9:12 p.m. OK PyPy 2 TESTS 36 810 9113600 1600
43695152 soumyasarkar1998 C Oct. 2, 2018, 4:08 p.m. OK PyPy 2 TESTS 36 966 716800 1600
41411238 wadissimo C Aug. 9, 2018, 8:25 p.m. OK PyPy 3 TESTS 36 186 7782400 1600
49663554 fascineted C Feb. 9, 2019, 1:28 p.m. OK PyPy 3 TESTS 36 187 7680000 1600
59590168 repper C Aug. 27, 2019, 8 p.m. OK PyPy 3 TESTS 36 187 10342400 1600
57960591 tchr C July 29, 2019, 10 p.m. OK PyPy 3 TESTS 36 202 6451200 1600
46648637 omarnvidia C Dec. 5, 2018, 12:58 p.m. OK PyPy 3 TESTS 36 218 6963200 1600
41388095 Evil__Coder C Aug. 9, 2018, 7:04 a.m. OK PyPy 3 TESTS 36 218 6963200 1600
41408164 lifefeeder C Aug. 9, 2018, 6:05 p.m. OK PyPy 3 TESTS 36 233 7475200 1600
41383319 hinser C Aug. 9, 2018, 3:47 a.m. OK PyPy 3 TESTS 36 233 7475200 1600
41660618 Khaled.Emad C Aug. 16, 2018, 5:50 p.m. OK PyPy 3 TESTS 36 234 7372800 1600
42196670 nurdtechie98 C Aug. 28, 2018, 6:45 a.m. OK PyPy 3 TESTS 36 248 8294400 1600
41367890 mesher.x C Aug. 8, 2018, 4:22 p.m. OK Python 2 TESTS 36 202 2048000 1600
41596804 Butane C Aug. 14, 2018, 5:17 p.m. OK Python 2 TESTS 36 202 6656000 1600
41402433 Mulx10 C Aug. 9, 2018, 2:28 p.m. OK Python 2 TESTS 36 202 6656000 1600
41426900 HeypaBHoBeceH C Aug. 10, 2018, 9:54 a.m. OK Python 2 TESTS 36 202 7270400 1600
41371228 aniketgattani C Aug. 8, 2018, 5:45 p.m. OK Python 2 TESTS 36 217 5836800 1600
41546762 shnamacedev C Aug. 13, 2018, 5:43 a.m. OK Python 2 TESTS 36 217 7270400 1600
47360935 biltharesatyendra C Dec. 22, 2018, 8:41 a.m. OK Python 2 TESTS 36 218 1945600 1600
41430175 tnowakow C Aug. 10, 2018, 12:07 p.m. OK Python 2 TESTS 36 218 2764800 1600
41361108 chaosagent C Aug. 8, 2018, 3:36 p.m. OK Python 2 TESTS 36 218 3072000 1600
41514356 nealzane C Aug. 12, 2018, 4:58 a.m. OK Python 2 TESTS 36 233 0 1600
41426874 liouzhou_101 C Aug. 10, 2018, 9:53 a.m. OK Python 3 TESTS 36 124 7168000 1600
41416575 orailly C Aug. 10, 2018, 3:25 a.m. OK Python 3 TESTS 36 124 7475200 1600
45276726 Jesse123 C Nov. 4, 2018, 11:29 a.m. OK Python 3 TESTS 36 140 7372800 1600
41426758 liouzhou_101 C Aug. 10, 2018, 9:49 a.m. OK Python 3 TESTS 36 140 7475200 1600
41358020 anagohirame C Aug. 8, 2018, 3:24 p.m. OK Python 3 TESTS 36 155 5222400 1600
41426800 liouzhou_101 C Aug. 10, 2018, 9:50 a.m. OK Python 3 TESTS 36 155 7372800 1600
41357758 Kelang C Aug. 8, 2018, 3:23 p.m. OK Python 3 TESTS 36 156 7168000 1600
41405007 version1.0 C Aug. 9, 2018, 4:05 p.m. OK Python 3 TESTS 36 171 102400 1600
41365633 bananaorange C Aug. 8, 2018, 4:03 p.m. OK Python 3 TESTS 36 171 1843200 1600
41396694 saku7 C Aug. 9, 2018, 11:31 a.m. OK Python 3 TESTS 36 171 7065600 1600
41374111 yat0pp C Aug. 8, 2018, 7:18 p.m. OK Ruby TESTS 36 108 102400 1600
41364368 geckods C Aug. 8, 2018, 3:54 p.m. OK Ruby TESTS 36 124 2662400 1600
63663828 sansen C Oct. 28, 2019, 2:39 p.m. OK Rust TESTS 36 31 1024000 1600
63651221 vjudge2 C Oct. 28, 2019, 11:26 a.m. OK Rust TESTS 36 46 1024000 1600

remove filters

Back to search problems