Codeforces Round 1047 (Div. 3)

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
2137 Codeforces Round 1047 (Div. 3) FINISHED False 8100 19149923 Sept. 7, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1916 ) G Cry Me a River PROGRAMMING dfs and similar dp games graphs

There is a directed acyclic graph with (n) nodes and (m) edges. Each node is initially colored blue. Let's define the fun graph game as follows: Initially, a token is placed on node (s). Cry and River take turns moving the token to a node such that there exists a directed edge from its current position to that node, with Cry going first. Cry wins if the token ever reaches a node with no outgoing edges, after either player's turn. River wins if the token reaches a red node after either player's turn. If the players reach a node that is both red and does not have outgoing edges, River wins. Since the graph is acyclic, it can be shown that the game always ends in a finite number of turns. Note that Cry and River can win the game immediately if the starting node (s) doesn't have outgoing edges, or is red respectively. You must handle (q) queries of the following kind: 1 u : update the color of node (u) to red. It is guaranteed that node (u) was blue before this update. 2 u : If a fun graph game is played with the token initially at node (u), and both players play optimally, does Cry win? 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 three integers (n), (m), (q) ((2 \leq n \leq 2\cdot 10^5) ,(1 \leq m,q \leq 2\cdot 10^5)). The following (m) lines each contain two integers (u) and (v) ((1 \leq u,v \leq n)), meaning that there is an edge from (u) to (v). The following (q) lines each contain two integers (x) and (u) ((1 \leq x \leq 2, 1 \leq u \leq n)) – denoting the type of query and the node that the query is done on. It is guaranteed that the given graph is a directed acyclic graph. Additionally, no edge is given more than once. It is guaranteed that the sum of (n), the sum of (m), and the sum of (q)

Tutorials

Codeforces Round 1047 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
337477422 VaHiX G Sept. 7, 2025, 10:24 p.m. OK C++17 (GCC 7-32) TESTS 22 234 16486400
337462501 free_time G Sept. 7, 2025, 6:45 p.m. OK C++17 (GCC 7-32) TESTS 22 265 2969600
337500421 aanamishra2407 G Sept. 8, 2025, 6:01 a.m. OK C++17 (GCC 7-32) TESTS 22 265 3686400
337454418 Narendra.Singh G Sept. 7, 2025, 5:39 p.m. OK C++17 (GCC 7-32) TESTS 22 265 4812800
337500065 wsy_jim G Sept. 8, 2025, 5:56 a.m. OK C++17 (GCC 7-32) TESTS 22 265 8089600
337447755 TheForsaking G Sept. 7, 2025, 4:59 p.m. OK C++17 (GCC 7-32) TESTS 22 281 22528000
337478203 h_squared G Sept. 7, 2025, 10:46 p.m. OK C++17 (GCC 7-32) TESTS 22 296 2969600
337500729 zeromc127 G Sept. 8, 2025, 6:05 a.m. OK C++17 (GCC 7-32) TESTS 22 296 4812800
337477140 lordlorinc G Sept. 7, 2025, 10:16 p.m. OK C++17 (GCC 7-32) TESTS 22 311 2560000
337468521 arpit_kr G Sept. 7, 2025, 7:54 p.m. OK C++17 (GCC 7-32) TESTS 22 311 7475200
337491629 Meguhine G Sept. 8, 2025, 3:45 a.m. OK C++20 (GCC 13-64) TESTS 22 234 4505600
337448109 NotFound G Sept. 7, 2025, 5:01 p.m. OK C++20 (GCC 13-64) TESTS 22 234 5632000
337483926 JustA7 G Sept. 8, 2025, 1:25 a.m. OK C++20 (GCC 13-64) TESTS 22 249 7270400
337468703 Ayham_Dabah G Sept. 7, 2025, 7:56 p.m. OK C++20 (GCC 13-64) TESTS 22 250 4505600
337461709 ikaurov G Sept. 7, 2025, 6:38 p.m. OK C++20 (GCC 13-64) TESTS 22 264 4096000
337486464 David_24 G Sept. 8, 2025, 2:23 a.m. OK C++20 (GCC 13-64) TESTS 22 264 7270400
337458288 John_zyj G Sept. 7, 2025, 6:07 p.m. OK C++20 (GCC 13-64) TESTS 22 264 10035200
337486593 David_24 G Sept. 8, 2025, 2:26 a.m. OK C++20 (GCC 13-64) TESTS 22 265 7270400
337455312 azure- G Sept. 7, 2025, 5:45 p.m. OK C++20 (GCC 13-64) TESTS 22 265 8089600
337471009 Ambug_Pls_Debug G Sept. 7, 2025, 8:23 p.m. OK C++20 (GCC 13-64) TESTS 22 265 9625600
337447989 424479543 G Sept. 7, 2025, 5 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 155 11264000
337446924 424479543 G Sept. 7, 2025, 4:55 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 156 13209600
337463665 naniwazu G Sept. 7, 2025, 6:57 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 233 4300800
337491875 BiaxialRay_ G Sept. 8, 2025, 3:50 a.m. OK C++23 (GCC 14-64, msys2) TESTS 22 233 10137600
337497575 FakeDuck G Sept. 8, 2025, 5:23 a.m. OK C++23 (GCC 14-64, msys2) TESTS 22 234 4608000
337460347 Arpa G Sept. 7, 2025, 6:25 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 234 6041600
337466145 brandonallen G Sept. 7, 2025, 7:25 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 234 7372800
337448808 7_divided_by_3 G Sept. 7, 2025, 5:04 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 249 7475200
337464806 virinci G Sept. 7, 2025, 7:10 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 249 7577600
337482233 enslaved G Sept. 8, 2025, 12:43 a.m. OK C++23 (GCC 14-64, msys2) TESTS 22 249 8396800
337477998 lyongwolf G Sept. 7, 2025, 10:40 p.m. OK Java 21 TESTS 22 343 409600
337475981 BOB_005 G Sept. 7, 2025, 9:53 p.m. OK Java 21 TESTS 22 702 35430400
337458046 dusty.and.rusty G Sept. 7, 2025, 6:05 p.m. OK Java 21 TESTS 22 952 36761600
337498057 kasiru_69 G Sept. 8, 2025, 5:30 a.m. OK Java 8 TESTS 22 937 32460800
337450490 Vinayak1031 G Sept. 7, 2025, 5:13 p.m. OK Java 8 TESTS 22 1046 68915200
337499008 biniyamnegasa G Sept. 8, 2025, 5:43 a.m. OK PyPy 3-64 TESTS 22 562 35532800
337475184 gardengnome G Sept. 7, 2025, 9:35 p.m. OK PyPy 3-64 TESTS 22 593 36556800
337475068 gardengnome G Sept. 7, 2025, 9:33 p.m. OK PyPy 3-64 TESTS 22 640 48230400
337488079 Little_Sheep_Yawn G Sept. 8, 2025, 2:50 a.m. OK PyPy 3-64 TESTS 22 703 59699200
337475318 gardengnome G Sept. 7, 2025, 9:37 p.m. OK PyPy 3-64 TESTS 22 717 37683200
337473402 sujal.gamer18 G Sept. 7, 2025, 9:01 p.m. OK PyPy 3-64 TESTS 22 812 101273600
337463403 sushmanth.dampur8780 G Sept. 7, 2025, 6:55 p.m. OK PyPy 3-64 TESTS 22 1390 128614400
337470639 kazumaa16 G Sept. 7, 2025, 8:17 p.m. OK PyPy 3-64 TESTS 22 1405 70451200
337472611 ToniPortocolom G Sept. 7, 2025, 8:48 p.m. OK PyPy 3-64 TESTS 22 1500 148480000
337486595 golomb G Sept. 8, 2025, 2:26 a.m. OK PyPy 3-64 TESTS 22 1514 67686400
337445358 AxilBlaze G Sept. 7, 2025, 4:49 p.m. OK Python 3 TESTS 22 1124 69324800
337472888 ToniPortocolom G Sept. 7, 2025, 8:52 p.m. OK Python 3 TESTS 22 1733 103731200
337498416 InO4 G Sept. 8, 2025, 5:35 a.m. OK Rust 2024 TESTS 22 140 19353600
337462135 constanze3 G Sept. 7, 2025, 6:42 p.m. OK Rust 2024 TESTS 22 1281 17612800

remove filters

Back to search problems