Kotlin Heroes: Episode 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
1211 Kotlin Heroes: Episode 2 FINISHED False 9000 163956299 Sept. 7, 2019, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 194 ) E Double Permutation Inc. PROGRAMMING *special binary search greedy 2200

B'Polycarp recently became an employee of the company "Double Permutation Inc." Now he is a fan of permutations and is looking for them everywhere! A permutation in this problem is a sequence of integers p_1, p_2, ... , p_k such that every integer from 1 to k occurs exactly once in it. For example, the following sequences are permutations of [3, 1, 4, 2] , [1] and [6, 1, 2, 3, 5, 4] . The following sequences are not permutations: [0, 1] , [1, 2, 2] , [1, 2, 4] and [2, 3] . In the lobby of the company 's headquarter statistics on visits to the company 's website for the last n days are published -- the sequence a_1, a_2, ... , a_n . Polycarp wants to color all the elements of this sequence in one of three colors (red, green or blue) so that: Help Polycarp to color all n numbers so that the total number of red and green elements is maximum. The first line contains an integer n ( 1 <= n <= 2 cdot10^5 ) -- the length of the sequence a . The second line contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 2 cdot10^5 ). Print a string s of length n such that: The string s should maximize the total number of red and green elements when fulfilling the requirements from the main part of the problem statement. If there are several optimal answers, print any of them. '...

Tutorials

Kotlin Heroes: Episode 2 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
60228285 Slamur E Sept. 7, 2019, 3:43 p.m. OK Kotlin TESTS 70 296 15360000 2200
60247076 Spheniscine E Sept. 8, 2019, 3:44 a.m. OK Kotlin TESTS 70 327 58163200 2200
60233920 Spheniscine E Sept. 7, 2019, 5:29 p.m. OK Kotlin TESTS 70 327 58163200 2200
60233508 nuip E Sept. 7, 2019, 5:18 p.m. OK Kotlin TESTS 70 343 15769600 2200
60230359 nuip E Sept. 7, 2019, 4:16 p.m. OK Kotlin TESTS 70 358 15769600 2200
60227931 .tx E Sept. 7, 2019, 3:38 p.m. OK Kotlin TESTS 70 358 29184000 2200
60228846 indy256 E Sept. 7, 2019, 3:51 p.m. OK Kotlin TESTS 70 389 819200 2200
60227696 Pepcy_Ch E Sept. 7, 2019, 3:33 p.m. OK Kotlin TESTS 70 390 17100800 2200
60228988 wleung_bvg E Sept. 7, 2019, 3:53 p.m. OK Kotlin TESTS 70 405 2252800 2200
60445296 shenqi16 E Sept. 12, 2019, 1:56 p.m. OK Kotlin TESTS 70 420 16076800 2200

remove filters

Back to search problems