Educational Codeforces Round 173 (Rated for 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
2043 Educational Codeforces Round 173 (Rated for Div. 2) FINISHED False 7200 41354723 Dec. 24, 2024, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 322 ) G Problem with Queries PROGRAMMING binary search brute force data structures

You are given an array (a), consisting of (n) integers. Your task is to process (q) queries of two types: (1~p~x) — set the value of the element at index (p) equal to (x); (2~l~r) — count the number of pairs of indices ((i, j)) such that (l \le i < j \le r) and (a_i \ne a_j). Note that the queries in this task are encoded ; each subsequent query can only be decoded after calculating the answer to the preceding query of the second type. The first line contains a single integer (n) ((1 \le n \le 10^5)). The second line contains (n) integers (a_1, a_2, \dots, a_n) ((1 \le a_i \le n)). The third line contains a single integer (q) ((1 \le q \le 3 \cdot 10^5)) — the number of queries. The next (q) lines describe the queries in one of the following formats: (1~p'~x') ((0 \le p', x' \le n-1)); (2~l'~r') ((0 \le l', r' \le n-1)). The queries are encoded as follows: let (\mathit{last}) be the answer to the latest processed query of the second type (initially, (\mathit{last} = 0)). if the type of the query is (1), then (p = ((p' + \mathit{last}) \bmod n) + 1), (x = ((x' + \mathit{last}) \bmod n) + 1). if the type of the query is (2), (l = ((l' + \mathit{last}) \bmod n) + 1), (r = ((r' + \mathit{last}) \bmod n) + 1). If (l > r), swap their values. Don't forget to update the value of (\mathit{last}) after answering each query of the second type. Additional constraint on the input: there is at least one query of the second type. For each query of the second type, print the answer — the number of pairs of indices ((i, j)) such that (l \le i < j \le r) and (a_i \ne a_j). In the first example, the actual queries (after decoding) are: 2 1 3 1 1 3 2 1 3 1 2 3 2 1 3

Tutorials

Educational Codeforces Round 173 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
298309259 leukocyte G Dec. 24, 2024, 5:17 p.m. OK C++17 (GCC 7-32) TESTS 117 4421 95129600
298309088 becaido G Dec. 24, 2024, 5:16 p.m. OK C++17 (GCC 7-32) TESTS 117 4859 130355200
298335391 ridwanulk08 G Dec. 24, 2024, 7:55 p.m. OK C++17 (GCC 7-32) TESTS 117 4859 210227200
298323472 IzhitskiyTimofey G Dec. 24, 2024, 7:02 p.m. OK C++20 (GCC 13-64) TESTS 117 2827 53145600
298323922 IzhitskiyTimofey G Dec. 24, 2024, 7:06 p.m. OK C++20 (GCC 13-64) TESTS 117 3015 53145600
298323828 IzhitskiyTimofey G Dec. 24, 2024, 7:05 p.m. OK C++20 (GCC 13-64) TESTS 117 3046 53145600
298323370 IzhitskiyTimofey G Dec. 24, 2024, 7:01 p.m. OK C++20 (GCC 13-64) TESTS 117 3171 46694400
298323690 IzhitskiyTimofey G Dec. 24, 2024, 7:04 p.m. OK C++20 (GCC 13-64) TESTS 117 3390 51916800
298323314 IzhitskiyTimofey G Dec. 24, 2024, 7:01 p.m. OK C++20 (GCC 13-64) TESTS 117 3483 46694400
298322897 VitalyKo G Dec. 24, 2024, 6:57 p.m. OK C++20 (GCC 13-64) TESTS 117 3593 43827200
298323140 IzhitskiyTimofey G Dec. 24, 2024, 6:59 p.m. OK C++20 (GCC 13-64) TESTS 117 3624 46694400
298321530 IzhitskiyTimofey G Dec. 24, 2024, 6:45 p.m. OK C++20 (GCC 13-64) TESTS 117 3765 46284800
298333468 rainboy G Dec. 24, 2024, 7:35 p.m. OK C++20 (GCC 13-64) TESTS 117 4187 51507200
298338001 thisthis G Dec. 24, 2024, 8:27 p.m. OK C++23 (GCC 14-64, msys2) TESTS 117 3280 229273600
298337201 thisthis G Dec. 24, 2024, 8:17 p.m. OK C++23 (GCC 14-64, msys2) TESTS 117 3655 326553600
298333391 noimi G Dec. 24, 2024, 7:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 117 3858 71987200
298351628 neal G Dec. 25, 2024, 2:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 117 3906 53145600
298351283 neal G Dec. 25, 2024, 1:57 a.m. OK C++23 (GCC 14-64, msys2) TESTS 117 3999 52326400
298343013 AndreyPavlov G Dec. 24, 2024, 9:46 p.m. OK C++23 (GCC 14-64, msys2) TESTS 117 4140 194969600
298335336 MoamenZ G Dec. 24, 2024, 7:55 p.m. OK C++23 (GCC 14-64, msys2) TESTS 117 4186 51507200
298351335 neal G Dec. 25, 2024, 1:59 a.m. OK C++23 (GCC 14-64, msys2) TESTS 117 4265 49868800
298333725 noimi G Dec. 24, 2024, 7:37 p.m. OK C++23 (GCC 14-64, msys2) TESTS 117 4421 61644800
298333484 noimi G Dec. 24, 2024, 7:35 p.m. OK C++23 (GCC 14-64, msys2) TESTS 117 4514 53350400

remove filters

Back to search problems