Codeforces Round 1057 (Div. 2)

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
2153 Codeforces Round 1057 (Div. 2) FINISHED False 8100 16298723 Oct. 10, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 321 ) F Odd Queries on Odd Array PROGRAMMING data structures trees

An array (b) of length (m) is cute if there do not exist four indices (1\le i < j < k < l \le m) such that (b_i\neq b_j), (b_i = b_k) and (b_j = b_l). The beauty of an array (b) of length (m) is defined as the sum of all distinct values that appear an odd number of times in array (b). Formally, let (\operatorname{cnt}(b, x)) denote the number of times the value (x) appears in array (b). Then, the beauty is given by ()\sum\limits_{\substack{x\in \mathbb{Z}\\\operatorname{cnt}(b, x)\text{ is odd}}}x.() You are given a cute array (a) of length (n), and you need to answer (q) queries online. Each query consists of two integers (l) and (r) ((1\le l\le r\le n)), and you must compute the beauty of the subarray (a_{l\ldots r})(^{\text{∗}}). Note that the queries are encoded; each subsequent query can only be decoded after calculating the answer to the preceding query. (^{\text{∗}})The subarray (a_{l \ldots r}) refers to the contiguous segment of the array (a) that starts at index (l) and ends at index (r), i.e., (a_l, a_{l+1}, \ldots, a_r). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains two integers (n) and (q) ((1\le n, q\le 5\cdot 10^5)) — the length of array (a) and the number of queries. The second line of each test case contains (n) integers (a_1, a_2, \ldots, a_n) ((1\le a_i\le n)) — the elements of the cute array (a). The (i)-th of the next (q) lines contains two integers (x'_i) and (y'_i) ((1\le x'_i, y'_i\le n)) — the endpoints of the queried subarray in an encoded form. Let (\text{ans}_i) be the answer to the (i)-th query, with (\text{ans}_0 = 0). Then, we calculate $$$x_i = ((x'_i - 1 + \text{ans}_{i - 1}) \bmod n) + 1$$

Tutorials

Codeforces Round 1057 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
343059205 TTO76 F Oct. 11, 2025, 3:07 a.m. OK C++17 (GCC 7-32) TESTS 73 687 26624000
343052373 zyjh F Oct. 11, 2025, 12:47 a.m. OK C++17 (GCC 7-32) TESTS 73 687 26624000
343033555 hoaquangthang F Oct. 10, 2025, 7:21 p.m. OK C++17 (GCC 7-32) TESTS 73 1031 43520000
343062305 sg0071729 F Oct. 11, 2025, 3:53 a.m. OK C++17 (GCC 7-32) TESTS 73 1577 337408000
343060248 sg0071729 F Oct. 11, 2025, 3:22 a.m. OK C++17 (GCC 7-32) TESTS 73 2030 818483200
343026542 Teja-Smart F Oct. 10, 2025, 6:28 p.m. OK C++17 (GCC 7-32) TESTS 73 2671 195584000
343013247 AFewSuns F Oct. 10, 2025, 4:45 p.m. OK C++17 (GCC 7-32) TESTS 73 2780 855756800
343059014 xvchongyv F Oct. 11, 2025, 3:04 a.m. OK C++17 (GCC 7-32) TESTS 73 5952 119603200
343058798 xvchongyv F Oct. 11, 2025, 3 a.m. OK C++17 (GCC 7-32) TESTS 73 6186 97382400
343059126 xvchongyv F Oct. 11, 2025, 3:06 a.m. OK C++17 (GCC 7-32) TESTS 73 6780 97382400
343023720 osmiyum F Oct. 10, 2025, 6:13 p.m. OK C++20 (GCC 13-64) TESTS 73 874 26624000
343061849 adam01 F Oct. 11, 2025, 3:47 a.m. OK C++20 (GCC 13-64) TESTS 73 1421 809676800
343041258 tiger2005 F Oct. 10, 2025, 8:40 p.m. OK C++20 (GCC 13-64) TESTS 73 2358 527257600
343061241 adam.jq.xu F Oct. 11, 2025, 3:38 a.m. OK C++20 (GCC 13-64) TESTS 73 2467 904089600
343012995 _runtimeTerror_ F Oct. 10, 2025, 4:44 p.m. OK C++20 (GCC 13-64) TESTS 73 2764 187494400
343024728 kotatsugame F Oct. 10, 2025, 6:18 p.m. OK C++20 (GCC 13-64) TESTS 73 2827 182067200
343071507 chikiak49 F Oct. 11, 2025, 5:38 a.m. OK C++20 (GCC 13-64) TESTS 73 3062 306585600
343051848 ShmilyTY F Oct. 11, 2025, 12:33 a.m. OK C++20 (GCC 13-64) TESTS 73 4030 52633600
343034475 negative-xp F Oct. 10, 2025, 7:28 p.m. OK C++20 (GCC 13-64) TESTS 73 4249 1033420800
343051765 ShmilyTY F Oct. 11, 2025, 12:31 a.m. OK C++20 (GCC 13-64) TESTS 73 4827 41369600
343059940 Ruthvik2835 F Oct. 11, 2025, 3:17 a.m. OK C++23 (GCC 14-64, msys2) TESTS 73 921 53452800
343023837 Nyaruratohotepu F Oct. 10, 2025, 6:14 p.m. OK C++23 (GCC 14-64, msys2) TESTS 73 1171 73523200
343051545 tin.le2 F Oct. 11, 2025, 12:24 a.m. OK C++23 (GCC 14-64, msys2) TESTS 73 1656 144384000
343055152 WTXwang F Oct. 11, 2025, 1:55 a.m. OK C++23 (GCC 14-64, msys2) TESTS 73 1656 174592000
343064242 noumanalidevloper F Oct. 11, 2025, 4:21 a.m. OK C++23 (GCC 14-64, msys2) TESTS 73 1765 133836800
343050886 weakpyt F Oct. 11, 2025, 12:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 73 1827 206848000
343056189 hungchi17 F Oct. 11, 2025, 2:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 73 2296 206848000
343024306 Nien_Hung F Oct. 10, 2025, 6:16 p.m. OK C++23 (GCC 14-64, msys2) TESTS 73 2452 206848000
343030790 lnsuyn F Oct. 10, 2025, 6:58 p.m. OK C++23 (GCC 14-64, msys2) TESTS 73 2609 380313600
343023517 realpsdoingdamyoo F Oct. 10, 2025, 6:12 p.m. OK C++23 (GCC 14-64, msys2) TESTS 73 2858 458342400
343052579 Ab_hoga_real_Cumback F Oct. 11, 2025, 12:52 a.m. OK Java 21 TESTS 73 2156 233164800
343062067 dalaboyevozodbek F Oct. 11, 2025, 3:50 a.m. OK PyPy 3-64 TESTS 73 2578 240128000
343074289 ericshen19555 F Oct. 11, 2025, 6:02 a.m. OK PyPy 3-64 TESTS 73 9187 667136000

remove filters

Back to search problems