Codeforces Round 1073 (Div. 1)

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
2190 Codeforces Round 1073 (Div. 1) FINISHED False 10800 7745123 Jan. 17, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 93 ) G Maximize Determinant PROGRAMMING graphs

An (n \times n) matrix (B) is called an interval matrix if for each row (i), there exists a contiguous range of columns (l_i, r_i) ((1 \le l_i \le r_i \le n)) filled with ones, while all other elements in the row are zero. Formally, (B_{i, j} = 1) if (l_i \le j \le r_i), and (B_{i, j} = 0) otherwise. You are given an integer (n) and an initial interval matrix (A), described by (n) triples ((l_i, r_i, a_i)). The (i)-th row of (A) corresponds to the interval (l_i, r_i), and (a_i) is the cost associated with modifying this row. Let (\mathcal{S}) be the set of all possible (n \times n) interval matrices. We define (X) as the maximum possible determinant among them: () X = \max\limits_{B \in \mathcal{S}} \operatorname{det}(B). () (Note that (|\mathcal{S}| = \left(\frac{n(n + 1)}{2}\right)^n), as each row can be any valid interval) Your goal is to transform (A) into a matrix (A') such that (\operatorname{det}(A') = X). To achieve this, you can perform the following operation any number of times: Choose a row index (i) ((1 \le i \le n)) and a new valid interval (L, R) ((1 \le L \le R \le n)). Replace the current interval of the (i)-th row with (L, R). The cost of this operation is (a_i). Find the minimum total cost required to make the determinant of the matrix equal to (X). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 5 \cdot 10^4)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((1 \le n \le 10^6)) — the size of the matrix. The next (n) lines describe the rows of the matrix (A). The (i)-th of these lines contains three integers (l_i), (r_i), and (a_i) ((1 \le l_i \le r_i \le n), (1 \le a_i \le 10^9)) — the interval boundaries and the cost of modifying the $

Tutorials

Codeforces Round 1073 (Div. 1, Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
358384947 s12116087 G Jan. 17, 2026, 8:09 p.m. OK C++17 (GCC 7-32) TESTS 63 2093 61644800
358394382 244mhq G Jan. 17, 2026, 11:43 p.m. OK C++20 (GCC 13-64) TESTS 63 1968 206233600
358369395 Ormlis G Jan. 17, 2026, 5:34 p.m. OK C++20 (GCC 13-64) TESTS 63 2406 224051200
358391574 ProjectCF G Jan. 17, 2026, 9:57 p.m. OK C++23 (GCC 14-64, msys2) TESTS 63 1500 409190400
358394827 daria.roganova71 G Jan. 18, 2026, 12:05 a.m. OK C++23 (GCC 14-64, msys2) TESTS 63 2359 225689600
358386237 maroonrk G Jan. 17, 2026, 8:26 p.m. OK C++23 (GCC 14-64, msys2) TESTS 63 2718 351539200
358385224 LeoPro G Jan. 17, 2026, 8:12 p.m. OK C++23 (GCC 14-64, msys2) TESTS 63 2843 436019200
358402811 khushicodes03 G Jan. 18, 2026, 3:50 a.m. OK C++23 (GCC 14-64, msys2) TESTS 63 2859 225689600
358366389 300iq G Jan. 17, 2026, 5:26 p.m. OK C++23 (GCC 14-64, msys2) TESTS 63 3250 323379200
358386965 rainboy G Jan. 17, 2026, 8:37 p.m. OK GNU C11 TESTS 63 1390 83046400
358336706 rainboy G Jan. 17, 2026, 4:09 p.m. OK GNU C11 TESTS 63 1515 82944000
358358761 rusters G Jan. 17, 2026, 5:03 p.m. OK Rust 2021 TESTS 63 1578 114278400

remove filters

Back to search problems