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 |
|---|---|---|---|---|---|---|
| 2011 | Kotlin Heroes: Episode 11 | FINISHED | False | 9000 | 48698723 | Sept. 30, 2024, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 57 ) | H | Strange Matrix | PROGRAMMING | *special graphs greedy |
You are given a matrix (a) of size (n \times m), consisting of integers from (0) to (31) inclusive. Let's call the matrix strange if for every two distinct rows (i) and (j), both of the following conditions hold: for every set of (k) indices ((x_1, x_2, \dots, x_k)), where (1 \le x_1 < x_2 < \cdots < x_k \le m), the equality (a_{i, x_1} \mathbin{\&} a_{j, x_1} \mathbin{\&} a_{i, x_2} \mathbin{\&} a_{j, x_2} \mathbin{\&} \cdots \mathbin{\&} a_{i, x_k} \mathbin{\&} a_{j, x_k} = 0) holds (where (\mathbin{\&}) — bitwise AND of two numbers); for every set of (k) indices ((x_1, x_2, \dots, x_k)), where (1 \le x_1 < x_2 < \cdots < x_k \le m), the equality (a_{i, x_1} \mathbin{|} a_{j, x_1} \mathbin{|} a_{i, x_2} \mathbin{|} a_{j, x_2} \mathbin{|} \cdots \mathbin{|} a_{i, x_k} \mathbin{|} a_{j, x_k} = 31) holds (where (\mathbin{|}) — bitwise OR of two numbers). You can perform the following operation any number of times: take any row of the matrix and a number (y) from (0) to (31) inclusive; then apply the bitwise XOR with the number (y) to all elements of the selected row. The cost of such an operation is equal to (y). Your task is to calculate the minimum cost to make the matrix strange, or report that it is impossible. The first line contains one integer (t) ((1 \le t \le 100)) — the number of test cases. The first line of each test case contains three integers (n), (m), and (k) ((1 \le n, m \le 50); (1 \le k \le m)). Next, there are (n) lines, the (i)-th of which contains (m) integers (a_{i, 1}, a_{i, 2}, \dots, a_{i, m}) ((0 \le a_{i, j} \le 31)). For each test case, output one integer — the minimum cost to make the matrix strange, or -1 if it is impossible to make the matrix strange. |
| Kotlin Heroes 11 — Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 283796286 | __jk__ | H | Sept. 30, 2024, 4:41 p.m. | OK | Kotlin 1.7 | TESTS | 34 | 687 | 42803200 | ||
| 283840629 | marvinthang | H | Oct. 1, 2024, 3:09 a.m. | OK | Kotlin 1.7 | TESTS | 34 | 874 | 64307200 | ||
| 283799798 | uwi | H | Sept. 30, 2024, 5:02 p.m. | OK | Kotlin 1.7 | TESTS | 34 | 1139 | 102502400 | ||
| 283798393 | WiwiHo | H | Sept. 30, 2024, 4:54 p.m. | OK | Kotlin 1.7 | TESTS | 34 | 1561 | 50790400 | ||
| 283791231 | LeoPro | H | Sept. 30, 2024, 4:10 p.m. | OK | Kotlin 1.7 | TESTS | 34 | 1796 | 81920000 | ||
| 283819460 | LeoPro | H | Sept. 30, 2024, 7:35 p.m. | OK | Kotlin 1.7 | TESTS | 34 | 1811 | 81510400 | ||
| 283789920 | wsyear | H | Sept. 30, 2024, 4:01 p.m. | OK | Kotlin 1.7 | TESTS | 34 | 1952 | 56524800 | ||
| 283793771 | Irmuun.Ch | H | Sept. 30, 2024, 4:26 p.m. | OK | Kotlin 1.7 | TESTS | 34 | 1968 | 69222400 | ||
| 283798140 | Egor | H | Sept. 30, 2024, 4:53 p.m. | OK | Kotlin 1.7 | TESTS | 34 | 1983 | 41881600 | ||
| 283791638 | cmk666 | H | Sept. 30, 2024, 4:12 p.m. | OK | Kotlin 1.7 | TESTS | 34 | 1999 | 79974400 | ||
| 283803430 | sd0061 | H | Sept. 30, 2024, 5:26 p.m. | OK | Kotlin 1.9 | TESTS | 34 | 264 | 0 | ||
| 283797151 | lmqzzz | H | Sept. 30, 2024, 4:47 p.m. | OK | Kotlin 1.9 | TESTS | 34 | 405 | 512000 | ||
| 283785777 | tourist | H | Sept. 30, 2024, 3:36 p.m. | OK | Kotlin 1.9 | TESTS | 34 | 406 | 102400 | ||
| 283835734 | Sparkle_Twilight | H | Oct. 1, 2024, 1:28 a.m. | OK | Kotlin 1.9 | TESTS | 34 | 421 | 307200 | ||
| 283833064 | yudedako | H | Oct. 1, 2024, 12:10 a.m. | OK | Kotlin 1.9 | TESTS | 34 | 421 | 307200 | ||
| 283790368 | Potassium | H | Sept. 30, 2024, 4:04 p.m. | OK | Kotlin 1.9 | TESTS | 34 | 499 | 512000 | ||
| 283794453 | Ra16bit | H | Sept. 30, 2024, 4:30 p.m. | OK | Kotlin 1.9 | TESTS | 34 | 608 | 204800 | ||
| 283794568 | Sulfox | H | Sept. 30, 2024, 4:31 p.m. | OK | Kotlin 1.9 | TESTS | 34 | 671 | 102400 | ||
| 283793362 | abc864197532 | H | Sept. 30, 2024, 4:23 p.m. | OK | Kotlin 1.9 | TESTS | 34 | 702 | 409600 | ||
| 283804025 | zhanghengrui | H | Sept. 30, 2024, 5:30 p.m. | OK | Kotlin 1.9 | TESTS | 34 | 796 | 409600 |
Back to search problems