Codeforces Round 319 (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
576 Codeforces Round 319 (Div. 1) FINISHED False 7800 334503023 Sept. 10, 2015, 4:30 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1499 ) E Painting Edges PROGRAMMING binary search data structures 3200

Note the unusual memory limit for this problem. You are given an undirected graph consisting of n vertices and m edges. The vertices are numbered with integers from 1 to n , the edges are numbered with integers from 1 to m . Each edge can be unpainted or be painted in one of the k colors, which are numbered with integers from 1 to k . Initially, none of the edges is painted in any of the colors. You get queries of the form "Repaint edge e i to color c i ". At any time the graph formed by the edges of the same color must be bipartite. If after the repaint this condition is violated, then the query is considered to be invalid and edge e i keeps its color. Otherwise, edge e i is repainted in color c i , and the query is considered to valid. Recall that the graph is called bipartite if the set of its vertices can be divided into two parts so that no edge connected vertices of the same parts. For example, suppose you are given a triangle graph, that is a graph with three vertices and edges (1, 2) , (2, 3) and (3, 1) . Suppose that the first two edges are painted color 1 , and the third one is painted color 2 . Then the query of "repaint the third edge in color 1 " will be incorrect because after its execution the graph formed by the edges of color 1 will not be bipartite. On the other hand, it is possible to repaint the second edge in color 2 . You receive q queries. For each query, you should either apply it, and report that the query is valid, or report that the query is invalid. The first line contains integers n , m , k , q ( 2 ≤ n ≤ 5·10 5 , 1 ≤ m , q ≤ 5·10 5 , 1 ≤ k ≤ 50 ) — the number of vertices, the number of edges, the number of colors and the number of queries. Then follow m edges of the graph in the form a i , b i ( 1 ≤ a i , b i ≤ n ). Then follow q queries of the form e i , c i ( 1 ≤ e i ≤ m , 1 ≤ c i ≤ k ). It is guaranteed that the graph doesn't contain multiple edges and loops. For each query print " YES " (without the quotes), if it is valid,

Tutorials

Editorial Codeforces Round #319

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
19925576 immortalCO E Aug. 17, 2016, 11:24 a.m. OK GNU C++ TESTS 104 763 202854400 3200
19925755 immortalCO E Aug. 17, 2016, 11:36 a.m. OK GNU C++ TESTS 104 826 202854400 3200
40986145 ReaLNero1 E July 30, 2018, 8:23 p.m. OK GNU C++ TESTS 104 904 200806400 3200
13467269 rxdoi E Oct. 7, 2015, 6:27 a.m. OK GNU C++ TESTS 104 1216 172236800 3200
13466821 rxdoi E Oct. 7, 2015, 5:53 a.m. OK GNU C++ TESTS 104 1231 172134400 3200
18574330 __debug E June 18, 2016, 8:05 a.m. OK GNU C++ TESTS 104 1232 488960000 3200
18574652 vjtest E June 18, 2016, 8:22 a.m. OK GNU C++ TESTS 104 1294 479539200 3200
18574410 fuboat E June 18, 2016, 8:09 a.m. OK GNU C++ TESTS 104 1341 479539200 3200
18573615 vjtest E June 18, 2016, 7:22 a.m. OK GNU C++ TESTS 104 1372 589209600 3200
18574246 fuboat E June 18, 2016, 7:59 a.m. OK GNU C++ TESTS 104 1403 479539200 3200
12974224 2222 E Sept. 12, 2015, 2:45 p.m. OK GNU C++11 TESTS 104 935 125542400 3200
57884602 lopare E July 28, 2019, 9:16 a.m. OK GNU C++11 TESTS 104 935 134860800 3200
12981393 SEXY69 E Sept. 13, 2015, 8:16 a.m. OK GNU C++11 TESTS 104 982 125542400 3200
14039664 00001 E Nov. 3, 2015, 9:44 a.m. OK GNU C++11 TESTS 104 998 125030400 3200
69874661 No268435 E Jan. 31, 2020, 3:11 a.m. OK GNU C++11 TESTS 104 1014 356249600 3200
57817189 py_ultron E July 26, 2019, 8:23 p.m. OK GNU C++11 TESTS 104 1029 134860800 3200
53598250 memset_inf E May 1, 2019, 6:03 a.m. OK GNU C++11 TESTS 104 1029 182374400 3200
23479504 Ali.Pi E Jan. 1, 2017, 7:20 a.m. OK GNU C++11 TESTS 104 1076 136908800 3200
23204249 wowYouMetADoge E Dec. 21, 2016, 4:14 p.m. OK GNU C++11 TESTS 104 1138 184422400 3200
13729749 krijgertje E Oct. 19, 2015, 2:12 p.m. OK GNU C++11 TESTS 104 1153 49254400 3200
57004239 Scut82 E July 14, 2019, 5:45 a.m. OK GNU C++14 TESTS 104 1262 395161600 3200
64717513 nqiiii E Nov. 11, 2019, 11:52 p.m. OK GNU C++14 TESTS 104 1528 348569600 3200
68110786 rushcheyo E Jan. 3, 2020, 9:27 a.m. OK GNU C++14 TESTS 104 1684 199577600 3200
69457999 AprilGrimoire E Jan. 24, 2020, 9:27 a.m. OK GNU C++14 TESTS 104 1825 490803200 3200
67502427 PinkRabbit E Dec. 24, 2019, 5:31 a.m. OK GNU C++14 TESTS 104 1918 186163200 3200
67486043 PinkRabbit E Dec. 23, 2019, 5:29 p.m. OK GNU C++14 TESTS 104 1949 186265600 3200
36450563 CQzhangyu E March 21, 2018, 10:03 a.m. OK GNU C++14 TESTS 104 1964 317542400 3200
66745772 Minamoto E Dec. 13, 2019, 2:03 a.m. OK GNU C++14 TESTS 104 1964 466534400 3200
68116974 QAQAutoMaton E Jan. 3, 2020, 11:49 a.m. OK GNU C++14 TESTS 104 1965 309555200 3200
36074363 vjudge2 E March 8, 2018, 2:37 p.m. OK GNU C++14 TESTS 104 1965 421580800 3200
69828689 HirasawaaYui E Jan. 30, 2020, 9:51 a.m. OK GNU C++17 TESTS 104 1528 355430400 3200
63102355 jiangly E Oct. 22, 2019, 1:50 a.m. OK GNU C++17 TESTS 104 1560 310681600 3200
58786924 Benq E Aug. 13, 2019, 11:31 p.m. OK GNU C++17 TESTS 104 2074 408678400 3200
52437333 vjudge1 E April 7, 2019, 4:35 a.m. OK GNU C++17 TESTS 104 2090 422502400 3200
65789865 Martin53 E Nov. 26, 2019, 9:22 p.m. OK GNU C++17 TESTS 104 2136 339456000 3200
64180655 Rubbish12345 E Nov. 4, 2019, 12:11 a.m. OK GNU C++17 TESTS 104 2183 305561600 3200
69222181 CMXRYNP E Jan. 21, 2020, 5:21 a.m. OK GNU C++17 TESTS 104 2246 318771200 3200
68010087 Elegia E Dec. 31, 2019, 3:17 p.m. OK GNU C++17 TESTS 104 2355 496128000 3200
66442455 ruo E Dec. 7, 2019, 8:25 a.m. OK GNU C++17 TESTS 104 2355 628019200 3200
65542600 Fulisike E Nov. 22, 2019, 4:02 p.m. OK GNU C++17 TESTS 104 2449 429875200 3200
13009432 mmaxio E Sept. 15, 2015, 2:30 p.m. OK Java 8 TESTS 104 1543 153395200 3200
12979581 antonkov E Sept. 13, 2015, 2:32 a.m. OK Java 8 TESTS 104 5928 528896000 3200

remove filters

Back to search problems