Educational Codeforces Round 174 (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
2069 Educational Codeforces Round 174 (Rated for Div. 2) FINISHED False 7200 36516323 Feb. 18, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 754 ) F Graph Inclusion PROGRAMMING data structures divide and conquer dsu

A connected component of an undirected graph is defined as a set of vertices (S) of this graph such that: for every pair of vertices ((u, v)) in (S), there exists a path between vertices (u) and (v); there is no vertex outside (S) that has a path to a vertex within (S). For example, the graph in the picture below has three components: (\{1, 3, 7, 8\}), (\{2\}), (\{4, 5, 6\}). We say that graph (A) includes graph (B) if every component of graph (B) is a subset of some component of graph (A). You are given two graphs, (A) and (B), both consisting of (n) vertices numbered from (1) to (n). Initially, there are no edges in the graphs. You must process queries of two types: add an edge to one of the graphs; remove an edge from one of the graphs. After each query, you have to calculate the minimum number of edges that have to be added to (A) so that (A) includes (B), and print it. Note that you don't actually add these edges, you just calculate their number. The first line contains two integers (n) and (q) ((2 \le n \le 4 \cdot 10^5); (1 \le q \le 4 \cdot 10^5)) — the number of vertices and queries, respectively. Next, there are (q) lines, where the (i)-th line describes the (i)-th query. The description of the query begins with the character (c_i) (either A or B ) — the graph to which the query should be applied. Then, two integers (x_i) and (y_i) follow ((1 \le x_i, y_i \le n); (x_i \ne y_i)). If there is an edge ((x_i, y_i)) in the corresponding graph, it should be removed; otherwise, it should be added to that graph. For each query, print one integer — the minimum number of edges that you have to add to the graph (A) so that it includes (B).

Tutorials

139774

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
306777686 matrixman8x F Feb. 18, 2025, 6:16 p.m. OK C++17 (GCC 7-32) TESTS 65 999 126668800
306762004 guptachintu570 F Feb. 18, 2025, 4:39 p.m. OK C++17 (GCC 7-32) TESTS 65 1171 156057600
306809781 LaDeX F Feb. 19, 2025, 2:06 a.m. OK C++17 (GCC 7-32) TESTS 65 1296 112947200
306806133 OneSheeep F Feb. 19, 2025, 12:44 a.m. OK C++17 (GCC 7-32) TESTS 65 1359 115507200
306810938 vventi F Feb. 19, 2025, 2:28 a.m. OK C++17 (GCC 7-32) TESTS 65 1390 110592000
306806124 SpadeA261 F Feb. 19, 2025, 12:44 a.m. OK C++17 (GCC 7-32) TESTS 65 1578 133324800
306764052 OdtreeKing F Feb. 18, 2025, 4:48 p.m. OK C++17 (GCC 7-32) TESTS 65 1624 272384000
306802751 quangdepzai F Feb. 18, 2025, 11:10 p.m. OK C++17 (GCC 7-32) TESTS 65 1640 118272000
306765197 .oink F Feb. 18, 2025, 4:54 p.m. OK C++17 (GCC 7-32) TESTS 65 1640 118272000
306782664 huxch135 F Feb. 18, 2025, 6:55 p.m. OK C++17 (GCC 7-32) TESTS 65 1718 114892800
306799928 kaiboy F Feb. 18, 2025, 10:12 p.m. OK C++20 (GCC 13-64) TESTS 65 733 26112000
306809333 zhouchenqi F Feb. 19, 2025, 1:56 a.m. OK C++20 (GCC 13-64) TESTS 65 983 75264000
306779113 DQ1275 F Feb. 18, 2025, 6:27 p.m. OK C++20 (GCC 13-64) TESTS 65 1140 141721600
306773669 4977 F Feb. 18, 2025, 5:48 p.m. OK C++20 (GCC 13-64) TESTS 65 1281 111616000
306805108 ahmetalp F Feb. 19, 2025, 12:18 a.m. OK C++20 (GCC 13-64) TESTS 65 1343 151142400
306774075 ereoth F Feb. 18, 2025, 5:51 p.m. OK C++20 (GCC 13-64) TESTS 65 1358 126259200
306786799 CReatiQ F Feb. 18, 2025, 7:32 p.m. OK C++20 (GCC 13-64) TESTS 65 1359 138035200
306818627 zeemanz F Feb. 19, 2025, 4:46 a.m. OK C++20 (GCC 13-64) TESTS 65 1390 127795200
306798419 tin.le2 F Feb. 18, 2025, 9:47 p.m. OK C++20 (GCC 13-64) TESTS 65 1406 151961600
306813392 Nlll F Feb. 19, 2025, 3:14 a.m. OK C++20 (GCC 13-64) TESTS 65 1421 152166400
306798838 424479543 F Feb. 18, 2025, 9:53 p.m. OK C++23 (GCC 14-64, msys2) TESTS 65 999 148275200
306791125 424479543 F Feb. 18, 2025, 8:17 p.m. OK C++23 (GCC 14-64, msys2) TESTS 65 999 162611200
306790701 424479543 F Feb. 18, 2025, 8:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 65 1078 182476800
306763796 beta99999 F Feb. 18, 2025, 4:47 p.m. OK C++23 (GCC 14-64, msys2) TESTS 65 1093 124620800
306809724 duckindog F Feb. 19, 2025, 2:04 a.m. OK C++23 (GCC 14-64, msys2) TESTS 65 1171 35123200
306796305 lrvideckis F Feb. 18, 2025, 9:15 p.m. OK C++23 (GCC 14-64, msys2) TESTS 65 1218 150323200
306790055 424479543 F Feb. 18, 2025, 8:06 p.m. OK C++23 (GCC 14-64, msys2) TESTS 65 1296 148684800
306796188 lrvideckis F Feb. 18, 2025, 9:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 65 1312 109260800
306808017 guagua0407 F Feb. 19, 2025, 1:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 65 1312 150323200
306796237 lrvideckis F Feb. 18, 2025, 9:14 p.m. OK C++23 (GCC 14-64, msys2) TESTS 65 1327 118579200

remove filters

Back to search problems