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 |
|---|---|---|---|---|---|---|
| 2106 | Codeforces Round 1020 (Div. 3) | FINISHED | False | 8100 | 30900323 | April 24, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 5903 ) | E | Wolf | PROGRAMMING | binary search greedy math |
Wolf has found (n) sheep with tastiness values (p_1, p_2, ..., p_n) where (p) is a permutation(^{\text{∗}}). Wolf wants to perform binary search on (p) to find the sheep with tastiness of (k), but (p) may not necessarily be sorted. The success of binary search on the range (l, r) for (k) is represented as (f(l, r, k)), which is defined as follows: If (l > r), then (f(l, r, k)) fails. Otherwise, let (m = \lfloor\frac{l + r}{2}\rfloor), and: If (p_m = k), then (f(l, r, k)) is successful , If (p_m < k), then (f(l, r, k) = f(m+1, r, k)), If (p_m > k), then (f(l, r, k) = f(l, m-1, k)). Cow the Nerd decides to help Wolf out. Cow the Nerd is given (q) queries, each consisting of three integers (l), (r), and (k). Before the search begins, Cow the Nerd may choose a non-negative integer (d), and (d) indices (1 \le i_1 < i_2 < \ldots < i_d \le n) where (p_{i_j} \neq k) over all (1 \leq j \leq d). Then, he may re-order the elements (p_{i_1}, p_{i_2}, ..., p_{i_d}) however he likes. For each query, output the minimum integer (d) that Cow the Nerd must choose so that (f(l, r, k)) can be successful , or report that it is impossible. Note that the queries are independent and the reordering is not actually performed. (^{\text{∗}})A permutation of length (n) is an array that contains every integer from (1) to (n) exactly once. The first line of the input contains a single integer (t) ((1 \le t \le 10^4)) — the number of test cases. The first line of each test contains two integers (n) and (q) ((1 \le n, q \le 2 \cdot 10^5)) — the length of (p) and the number of queries respectively. The second line contains (n) integers (p_1, p_2, ..., p_n) — the tastiness of the (i)-th sheep. It is guaranteed that every integer from (1) to (n) appears exactly once in (p). The following (q) lines con |
| Codeforces Round 1020 (Div. 3) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 317081111 | Lyr_ids | E | April 24, 2025, 5:07 p.m. | OK | C++17 (GCC 7-32) | TESTS | 14 | 124 | 2662400 | ||
| 317125397 | hariaumm | E | April 25, 2025, 3:47 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 203 | 0 | ||
| 317107227 | bugdone | E | April 24, 2025, 9:25 p.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 218 | 0 | ||
| 317079087 | SinceToday | E | April 24, 2025, 4:55 p.m. | OK | C++17 (GCC 7-32) | TESTS | 14 | 218 | 0 | ||
| 317081801 | TiLTovozzik | E | April 24, 2025, 5:11 p.m. | OK | C++17 (GCC 7-32) | TESTS | 14 | 218 | 102400 | ||
| 317074381 | Apoorvvv | E | April 24, 2025, 4:44 p.m. | OK | C++17 (GCC 7-32) | TESTS | 14 | 218 | 1638400 | ||
| 317129639 | Hanggoash | E | April 25, 2025, 4:59 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 233 | 0 | ||
| 317081002 | Yahia_Talaat88 | E | April 24, 2025, 5:06 p.m. | OK | C++17 (GCC 7-32) | TESTS | 14 | 233 | 0 | ||
| 317080670 | sjz111 | E | April 24, 2025, 5:04 p.m. | OK | C++17 (GCC 7-32) | TESTS | 14 | 233 | 0 | ||
| 317079382 | dsn_20051209 | E | April 24, 2025, 4:57 p.m. | OK | C++17 (GCC 7-32) | TESTS | 14 | 233 | 0 |
Back to search problems