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
( 11 ) I Minimum Difference PROGRAMMING *special

You are given an integer array (a) of size (n). You have to perform (m) queries. Each query has one of two types: "(1) (l) (r) (k)" — calculate the minimum value (dif) such that there are exist (k) distinct integers (x_1, x_2, \dots, x_k) such that (cnt_i > 0) (for every (i \in 1, k)) and (|cnt_i - cnt_j| \le dif) (for every (i \in 1, k, j \in 1, k)), where (cnt_i) is the number of occurrences of (x_i) in the subarray (al..r). If it is impossible to choose (k) integers, report it; "(2) (p) (x)" — assign (a_{p} := x). The first line contains two integers (n) and (m) ((1 \le n, m \le 10^5)) — the size of the array (a) and the number of queries. The second line contains (n) integers (a_1, a_2, \dots, a_n) ((1 \le a_i \le 10^5)). Next (m) lines contain queries (one per line). Each query has one of two types: "(1) (l) (r) (k)" ((1 \le l \le r \le n; 1 \le k \le 10^5)) "(2) (p) (x)" ((1 \le p \le n; 1 \le x \le 10^5)). It's guaranteed that there is at least one query of the first type. For each query of the first type, print the minimum value of (dif) that satisfies all required conditions, or (-1) if it is impossible to choose (k) distinct integers.

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
130508831 Igorjan94 I Oct. 1, 2021, 10:17 p.m. OK Kotlin 1.4 TESTS 133 3181 29900800
130603690 jimm89 I Oct. 2, 2021, 10:54 p.m. OK Kotlin 1.4 TESTS 133 6114 31436800
130500753 Bugman I Oct. 1, 2021, 7:17 p.m. OK Kotlin 1.4 TESTS 133 7269 34406400
130500838 Bugman I Oct. 1, 2021, 7:19 p.m. OK Kotlin 1.4 TESTS 133 7284 32972800
130500319 Bugman I Oct. 1, 2021, 7:11 p.m. OK Kotlin 1.4 TESTS 133 9484 34406400
130586533 Tlatoani I Oct. 2, 2021, 5:18 p.m. OK Kotlin 1.5 TESTS 133 4398 31436800
130586380 Tlatoani I Oct. 2, 2021, 5:15 p.m. OK Kotlin 1.5 TESTS 133 4445 31436800
130584010 Tlatoani I Oct. 2, 2021, 4:43 p.m. OK Kotlin 1.5 TESTS 133 4461 30822400
131003116 Roll_Num_56 I Oct. 6, 2021, 5:41 p.m. OK Kotlin 1.5 TESTS 133 8252 58368000
131002905 Roll_Num_56 I Oct. 6, 2021, 5:38 p.m. OK Kotlin 1.5 TESTS 133 9016 52326400

remove filters

Back to search problems