Kotlin Heroes: Episode 3

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
1297 Kotlin Heroes: Episode 3 FINISHED False 9000 149012699 Feb. 27, 2020, 1:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 400 ) C Dream Team PROGRAMMING *special greedy

B'Polycarp is the project manager in the IT-company. Right now, he needs to choose developers for his team to start a new project. The company has n developers "on the bench" (i.e not involved in other projects). Polycarp assessed the skills of each of them: a_i ( -10^4 <= a_i <= 10^4 ) -- an integer characteristic of the i -th developer. This value can be either positive, zero or even negative (some developers cause distractions). After Polycarp chooses a subset of developers for his team, the strength of the team will be determined by the sum of a_i values for all selected developers. Polycarp fears that if he chooses a team in such a way that maximizes the sum of the characteristics of a_i , other managers may find this unacceptable. For this reason, he plans to create such a team that the sum of the a_i values for it is strictly less than the maximum possible value. Help Polycarp choose any team that: If, following the requirements above, you can select a team in several ways, then just find any of them. It 's guaranteed that the sum of the characteristics in the desired subset is strictly positive (i.e. Polycarp can always choose a non-empty team). The first line contains one integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Then t test cases follow. Each test case begins with a line containing one integer n ( 2 <= n <= 10^5 ) -- the number of developers "on the bench". The second line of a test case contains a sequence of integers a_1, a_2, ... , a_n ( -10^4 <= a_i <= 10^4 ) -- the characteristics of the n developers. It is guaranteed that the characteristics are such that the sum of the characteristics in the answer is strictly positive. It is guaranteed that the sum of n over all test cases in the input doesn 't exceed 10^5 . Print the answers for the given t test cases in the order that they appear in the input. In the first line of e'...

Tutorials

Kotlin Heroes: Episode 3 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
72025108 Ebrahim_Emon C Feb. 28, 2020, 9:08 a.m. OK Kotlin TESTS 15 124 0
71981158 zucker42 C Feb. 27, 2020, 2:32 p.m. OK Kotlin TESTS 15 124 0
71978362 icebound C Feb. 27, 2020, 2:02 p.m. OK Kotlin TESTS 15 124 0
71976826 Egor C Feb. 27, 2020, 1:47 p.m. OK Kotlin TESTS 15 124 0
71976547 xiaowuc1 C Feb. 27, 2020, 1:45 p.m. OK Kotlin TESTS 15 124 0
71983836 hzk C Feb. 27, 2020, 3:04 p.m. OK Kotlin TESTS 15 139 0
71982191 falanga C Feb. 27, 2020, 2:44 p.m. OK Kotlin TESTS 15 139 0
71980868 avm C Feb. 27, 2020, 2:29 p.m. OK Kotlin TESTS 15 139 0
71980027 mban259 C Feb. 27, 2020, 2:19 p.m. OK Kotlin TESTS 15 139 0
71977957 dalt C Feb. 27, 2020, 1:58 p.m. OK Kotlin TESTS 15 139 21299200

remove filters

Back to search problems