Kotlin Heroes: Practice 8

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
1570 Kotlin Heroes: Practice 8 FINISHED False 518400 143310323 Oct. 1, 2021, 1:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 359 ) B Yellow Cards PROGRAMMING *special math

The final match of the Berland Football Cup has been held recently. The referee has shown (n) yellow cards throughout the match. At the beginning of the match there were (a_1) players in the first team and (a_2) players in the second team. The rules of sending players off the game are a bit different in Berland football. If a player from the first team receives (k_1) yellow cards throughout the match, he can no longer participate in the match — he's sent off. And if a player from the second team receives (k_2) yellow cards, he's sent off. After a player leaves the match, he can no longer receive any yellow cards. Each of (n) yellow cards was shown to exactly one player. Even if all players from one team (or even from both teams) leave the match, the game still continues. The referee has lost his records on who has received each yellow card. Help him to determine the minimum and the maximum number of players that could have been thrown out of the game. The first line contains one integer (a_1) ((1 \le a_1 \le 1\,000)) — the number of players in the first team. The second line contains one integer (a_2) ((1 \le a_2 \le 1\,000)) — the number of players in the second team. The third line contains one integer (k_1) ((1 \le k_1 \le 1\,000)) — the maximum number of yellow cards a player from the first team can receive (after receiving that many yellow cards, he leaves the game). The fourth line contains one integer (k_2) ((1 \le k_2 \le 1\,000)) — the maximum number of yellow cards a player from the second team can receive (after receiving that many yellow cards, he leaves the game). The fifth line contains one integer (n) ((1 \le n \le a_1 \cdot k_1 + a_2 \cdot k_2)) — the number of yellow cards that have been shown during the match. Print two integers — the minimum and the maximum number of players that could have been thrown out of the game. In the first example it could be possible that no player

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
130475401 anubhav100rao B Oct. 1, 2021, 2:44 p.m. OK Kotlin 1.4 TESTS 44 93 20889600
130544908 nmrsmn B Oct. 2, 2021, 9:14 a.m. OK Kotlin 1.4 TESTS 44 108 0
131103836 pankaj_m05 B Oct. 7, 2021, 9:03 p.m. OK Kotlin 1.4 TESTS 44 108 20889600
131069639 Heart_Blue B Oct. 7, 2021, 1:17 p.m. OK Kotlin 1.4 TESTS 44 108 20889600
131033235 present_sir B Oct. 7, 2021, 5:52 a.m. OK Kotlin 1.4 TESTS 44 108 20889600
131007337 AudM B Oct. 6, 2021, 6:43 p.m. OK Kotlin 1.4 TESTS 44 108 20889600
130844722 Aspirant B Oct. 4, 2021, 11:20 p.m. OK Kotlin 1.4 TESTS 44 108 20889600
130831891 Georggg999 B Oct. 4, 2021, 6:06 p.m. OK Kotlin 1.4 TESTS 44 108 20889600
130805027 f_cktorial B Oct. 4, 2021, 1:36 p.m. OK Kotlin 1.4 TESTS 44 108 20889600
130620204 farmerboy B Oct. 3, 2021, 6:27 a.m. OK Kotlin 1.4 TESTS 44 108 20889600
131061516 XeroxAuto B Oct. 7, 2021, 11:54 a.m. OK Kotlin 1.5 TESTS 44 171 25292800
130844216 amir_avrahami B Oct. 4, 2021, 10:51 p.m. OK Kotlin 1.5 TESTS 44 171 25292800
130835527 MH_Parag B Oct. 4, 2021, 6:59 p.m. OK Kotlin 1.5 TESTS 44 186 25190400
131109498 pallgu89 B Oct. 8, 2021, 1:12 a.m. OK Kotlin 1.5 TESTS 44 186 25292800
131066761 epsilon_573 B Oct. 7, 2021, 12:46 p.m. OK Kotlin 1.5 TESTS 44 186 25292800
131047540 Florian3k B Oct. 7, 2021, 8:58 a.m. OK Kotlin 1.5 TESTS 44 186 25292800
130995883 cracyx B Oct. 6, 2021, 4:13 p.m. OK Kotlin 1.5 TESTS 44 186 25292800
130973630 mip182 B Oct. 6, 2021, 11:59 a.m. OK Kotlin 1.5 TESTS 44 186 25292800
130934838 you_dont_know_me B Oct. 6, 2021, 1:58 a.m. OK Kotlin 1.5 TESTS 44 186 25292800
130922316 paulviaz B Oct. 5, 2021, 7:22 p.m. OK Kotlin 1.5 TESTS 44 186 25292800

remove filters

Back to search problems