Codeforces Round 1086 (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
2208 Codeforces Round 1086 (Div. 2) FINISHED False 7200 2906723 March 14, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 4041 ) D1 Tree Orientation (Easy Version) PROGRAMMING constructive algorithms dfs and similar dsu graphs greedy trees

This is the easy version of the problem. The difference between the versions is that in this version, the constraint on (n) is lower. You can hack only if you solved all versions of this problem. You once had an undirected tree with (n) nodes. To make the tree look more interesting, you decided to assign an arbitary direction to each of the (n-1) edges. As time goes by, you forgot the structure of your tree. However, you found a note which recorded after the direction of the edges have been assigned, whether (u) can reach (v)(^{\text{∗}}) for all ordered pairs of ((u,v)) which satisfies (1\le u,v\le n). You want to find out the structure of the tree and the direction of the edges from the information given by the note. Determine if there is possible solution and construct one. If there are multiple solutions, you only need to find one of them. (^{\text{∗}})For a directed graph, we say that (x) can reach (y) if and only if there exists a sequence of nodes (u_1,u_2,\ldots,u_k) such that (u_1=x,u_k=y) and for all (i) from (2) to (k), the directed edge (u_{i-1}\rightarrow u_i) exists. In particular, a node can always reach itself. 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 cases contain an integer (n) ((2\le n\le 500)) denoting the number of nodes your tree have. The following (n) lines contain a string (s_i). (s_i) is of length (n) and consists only of (0) and (1). The (j)-th character of (s_i) is (1) if and only if (i) can reach (j) after the edges are directed. It is guaranteed that the sum of (n^3) over all test cases does not exceed (500^3). For each testcase, output (Yes) if a solution exists, otherwise print (No). If the answer is (Yes), on

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
366708514 EndeavourCHN D1 March 14, 2026, 4:32 p.m. OK C++17 (GCC 7-32) TESTS 30 62 0
366705375 _Mohammed_Yasser_ D1 March 14, 2026, 4:25 p.m. OK C++17 (GCC 7-32) TESTS 30 62 0
366708245 vicky_badshah D1 March 14, 2026, 4:31 p.m. OK C++17 (GCC 7-32) TESTS 30 62 102400
366706387 Tai_Yang D1 March 14, 2026, 4:27 p.m. OK C++17 (GCC 7-32) TESTS 30 62 102400
366706379 poat D1 March 14, 2026, 4:27 p.m. OK C++17 (GCC 7-32) TESTS 30 62 102400
366706062 Hank999 D1 March 14, 2026, 4:26 p.m. OK C++17 (GCC 7-32) TESTS 30 62 102400
366700353 anuragp2003b D1 March 14, 2026, 4:13 p.m. OK C++17 (GCC 7-32) TESTS 30 62 102400
366736120 BadEngineer D1 March 14, 2026, 9:14 p.m. OK C++17 (GCC 7-32) TESTS 30 62 307200
366715662 Mihai_Georgescu D1 March 14, 2026, 5:37 p.m. OK C++17 (GCC 7-32) TESTS 30 62 409600
366715866 Zzzyt D1 March 14, 2026, 5:38 p.m. OK C++17 (GCC 7-32) TESTS 30 62 64614400
366728191 d.ot D1 March 14, 2026, 7:35 p.m. OK C++20 (GCC 13-64) TESTS 30 46 102400
366725988 sanglapcodes D1 March 14, 2026, 7:10 p.m. OK C++20 (GCC 13-64) TESTS 30 62 102400
366724644 vishu1204 D1 March 14, 2026, 6:56 p.m. OK C++20 (GCC 13-64) TESTS 30 62 102400
366724614 vasavjain D1 March 14, 2026, 6:56 p.m. OK C++20 (GCC 13-64) TESTS 30 62 102400
366709553 harsh_01_ D1 March 14, 2026, 4:34 p.m. OK C++20 (GCC 13-64) TESTS 30 62 102400
366708288 POLYMORPHIC_PHANTOM D1 March 14, 2026, 4:31 p.m. OK C++20 (GCC 13-64) TESTS 30 62 102400
366707406 askmecode2003 D1 March 14, 2026, 4:29 p.m. OK C++20 (GCC 13-64) TESTS 30 62 102400
366706981 dhruvv_7 D1 March 14, 2026, 4:28 p.m. OK C++20 (GCC 13-64) TESTS 30 62 102400
366706477 habibie.lukman D1 March 14, 2026, 4:27 p.m. OK C++20 (GCC 13-64) TESTS 30 62 102400
366704487 SuPythony D1 March 14, 2026, 4:23 p.m. OK C++20 (GCC 13-64) TESTS 30 62 102400
366739017 415411 D1 March 14, 2026, 10:05 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 46 102400
366727890 VitaminA D1 March 14, 2026, 7:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 46 102400
366706592 Bodhi365 D1 March 14, 2026, 4:28 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 46 102400
366702525 faitboll D1 March 14, 2026, 4:18 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 46 102400
366701935 NotAndyyy D1 March 14, 2026, 4:16 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 46 102400
366700636 Gustavo-d D1 March 14, 2026, 4:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 46 409600
366706398 Procrashtinating D1 March 14, 2026, 4:27 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 46 64614400
366703298 Aldk D1 March 14, 2026, 4:20 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 46 64819200
366703566 HubertM6 D1 March 14, 2026, 4:20 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 46 129024000
366733845 _raayyyaaaannnnn_ D1 March 14, 2026, 8:43 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 46 513433600
366752963 buitS D1 March 15, 2026, 3:23 a.m. OK Java 21 TESTS 30 250 716800
366754186 sakthimuruganv2005 D1 March 15, 2026, 3:44 a.m. OK Java 21 TESTS 30 265 716800
366709322 NodeMon D1 March 14, 2026, 4:33 p.m. OK Java 21 TESTS 30 265 1228800
366700899 shortestpi D1 March 14, 2026, 4:14 p.m. OK Java 21 TESTS 30 281 1638400
366701639 parmarmeet603 D1 March 14, 2026, 4:16 p.m. OK Java 21 TESTS 30 296 409600
366702279 PandaAK D1 March 14, 2026, 4:17 p.m. OK Java 21 TESTS 30 296 512000
366707381 Adi_Stark D1 March 14, 2026, 4:29 p.m. OK Java 21 TESTS 30 296 1536000
366726329 shubhansh_gupta D1 March 14, 2026, 7:14 p.m. OK Java 21 TESTS 30 296 2252800
366703197 manmohan0singh0 D1 March 14, 2026, 4:20 p.m. OK Java 21 TESTS 30 312 1024000
366703362 aashikajaiswal772 D1 March 14, 2026, 4:20 p.m. OK Java 21 TESTS 30 343 921600
366702976 namitha.23bce11620 D1 March 14, 2026, 4:19 p.m. OK Java 8 TESTS 30 343 0
366703166 yashbansal99 D1 March 14, 2026, 4:19 p.m. OK Java 8 TESTS 30 359 0
366708648 Karthikeya__00 D1 March 14, 2026, 4:32 p.m. OK Java 8 TESTS 30 390 0
366721699 kamranm D1 March 14, 2026, 6:26 p.m. OK Java 8 TESTS 30 953 109363200
366707007 Hanlabong D1 March 14, 2026, 4:28 p.m. OK Kotlin 1.9 TESTS 30 171 0
366700054 nullbrain_ D1 March 14, 2026, 4:12 p.m. OK Kotlin 2.2 TESTS 30 171 24883200
366707221 bu_gye_jeong D1 March 14, 2026, 4:29 p.m. OK Node.js TESTS 30 265 25190400
366702938 wamachine_ D1 March 14, 2026, 4:19 p.m. OK PHP TESTS 30 531 14848000
366714063 Omarr. D1 March 14, 2026, 5:25 p.m. OK PyPy 3-64 TESTS 30 250 14745600
366732024 syncrain D1 March 14, 2026, 8:20 p.m. OK PyPy 3-64 TESTS 30 250 15155200
366706944 VivirAstucia D1 March 14, 2026, 4:28 p.m. OK PyPy 3-64 TESTS 30 281 10342400
366708984 lew2018 D1 March 14, 2026, 4:33 p.m. OK PyPy 3-64 TESTS 30 281 14745600
366722382 kazukun1311 D1 March 14, 2026, 6:33 p.m. OK PyPy 3-64 TESTS 30 312 16588800
366708710 Amogh_Gajera D1 March 14, 2026, 4:32 p.m. OK PyPy 3-64 TESTS 30 390 10035200
366762269 Kian_1t D1 March 15, 2026, 5:43 a.m. OK PyPy 3-64 TESTS 30 390 16486400
366703679 Kerkeden D1 March 14, 2026, 4:21 p.m. OK PyPy 3-64 TESTS 30 406 9523200
366701347 quandum D1 March 14, 2026, 4:15 p.m. OK PyPy 3-64 TESTS 30 406 10240000
366701146 hiraite D1 March 14, 2026, 4:15 p.m. OK PyPy 3-64 TESTS 30 421 10444800
366708192 satwiksps D1 March 14, 2026, 4:31 p.m. OK Python 3 TESTS 30 312 11980800
366704904 LEO__1101 D1 March 14, 2026, 4:24 p.m. OK Python 3 TESTS 30 312 12288000
366702344 Siyam2000 D1 March 14, 2026, 4:17 p.m. OK Python 3 TESTS 30 421 819200
366710158 Kaylode D1 March 14, 2026, 4:34 p.m. OK Python 3 TESTS 30 421 10035200
366707930 TheCelestialCube D1 March 14, 2026, 4:31 p.m. OK Python 3 TESTS 30 875 4403200
366709746 darkakashihunter D1 March 14, 2026, 4:34 p.m. OK Python 3 TESTS 30 1046 2048000
366720611 jay_raychura D1 March 14, 2026, 6:17 p.m. OK Python 3 TESTS 30 1296 2048000
366709240 buildandcrack D1 March 14, 2026, 4:33 p.m. OK Python 3 TESTS 30 1343 3174400
366706167 VSS402002_Muhammad_Adil D1 March 14, 2026, 4:26 p.m. OK Python 3 TESTS 30 2687 13107200
366702094 FerryMan27 D1 March 14, 2026, 4:17 p.m. OK Python 3 TESTS 30 2796 10137600
366729591 viniciusth D1 March 14, 2026, 7:50 p.m. OK Rust 2024 TESTS 30 109 11776000
366718611 redgex D1 March 14, 2026, 6 p.m. OK Rust 2024 TESTS 30 265 11776000
366706451 hardgonnapass D1 March 14, 2026, 4:27 p.m. OK Scala TESTS 30 531 0

remove filters

Back to search problems