Codeforces Round 747 (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
1594 Codeforces Round 747 (Div. 2) FINISHED False 8100 103474463 Oct. 8, 2021, 3:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 7690 ) D The Number of Imposters PROGRAMMING constructive algorithms dfs and similar dp ds graphs 1700

B'Theofanis started playing the new online game called "Among them". However, he always plays with Cypriot players, and they all have the same name: "Andreas" (the most common name in Cyprus). In each game, Theofanis plays with n other players. Since they all have the same name, they are numbered from 1 to n . The players write m comments in the chat. A comment has the structure of " i j c " where i and j are two distinct integers and c is a string ( 1 <= i, j <= n ; i neq j ; c is either imposter or crewmate). The comment means that player i said that player j has the role c . An imposter always lies, and a crewmate always tells the truth. Help Theofanis find the maximum possible number of imposters among all the other Cypriot players, or determine that the comments contradict each other (see the notes for further explanation). Note that each player has exactly one role: either imposter or crewmate. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Description of each test case follows. The first line of each test case contains two integers n and m ( 1 <= n <= 2 cdot 10^5 ; 0 <= m <= 5 cdot 10^5 ) -- the number of players except Theofanis and the number of comments. Each of the next m lines contains a comment made by the players of the structure " i j c " where i and j are two distinct integers and c is a string ( 1 <= i, j <= n ; i neq j ; c is either imposter or crewmate). There can be multiple comments for the same pair of (i, j) . It is guaranteed that the sum of all n does not exceed 2 cdot 10^5 and the sum of all m does not exceed 5 cdot 10^5 . For each test case, print one integer -- the maximum possible number of imposters. If the comments contradict each other, print -1 . In the fi'...

Tutorials

95525

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
131225680 tokitsukaze D Oct. 8, 2021, 5:06 p.m. OK GNU C++14 TESTS 26 93 15052800 1700
131265748 stoorz D Oct. 9, 2021, 3:42 a.m. OK GNU C++14 TESTS 26 311 14540800 1700
131253540 atao D Oct. 9, 2021, 12:55 a.m. OK GNU C++14 TESTS 26 312 9011200 1700
131265462 _jsgnt D Oct. 9, 2021, 3:37 a.m. OK GNU C++14 TESTS 26 327 8601600 1700
131265090 A_normal_OIer D Oct. 9, 2021, 3:30 a.m. OK GNU C++14 TESTS 26 327 13004800 1700
131264560 luogu_bot3 D Oct. 9, 2021, 3:19 a.m. OK GNU C++14 TESTS 26 327 13004800 1700
131263945 slenbol D Oct. 9, 2021, 3:09 a.m. OK GNU C++14 TESTS 26 327 13004800 1700
131227156 Shinkiw D Oct. 8, 2021, 5:10 p.m. OK GNU C++14 TESTS 26 327 23756800 1700
131252053 E-ray D Oct. 9, 2021, 12:06 a.m. OK GNU C++14 TESTS 26 342 9728000 1700
131263073 connertakehana D Oct. 9, 2021, 2:53 a.m. OK GNU C++14 TESTS 26 358 7782400 1700
131237408 BambooWind D Oct. 8, 2021, 6:36 p.m. OK GNU C++17 TESTS 26 280 20480000 1700
131236180 SkeletonK D Oct. 8, 2021, 6:22 p.m. OK GNU C++17 TESTS 26 296 15462400 1700
131237375 135esque D Oct. 8, 2021, 6:35 p.m. OK GNU C++17 TESTS 26 311 17203200 1700
131265201 TTNhan D Oct. 9, 2021, 3:32 a.m. OK GNU C++17 TESTS 26 327 11059200 1700
131272946 yizhiyezi D Oct. 9, 2021, 5:31 a.m. OK GNU C++17 TESTS 26 342 8499200 1700
131261880 Igorjan94 D Oct. 9, 2021, 2:28 a.m. OK GNU C++17 TESTS 26 342 11878400 1700
131254088 lxxxl D Oct. 9, 2021, 1:10 a.m. OK GNU C++17 TESTS 26 343 6963200 1700
131256896 quanshr D Oct. 9, 2021, 1:59 a.m. OK GNU C++17 TESTS 26 343 9728000 1700
131247193 phoenix91 D Oct. 8, 2021, 9:09 p.m. OK GNU C++17 TESTS 26 358 14540800 1700
131228342 itish D Oct. 8, 2021, 5:13 p.m. OK GNU C++17 TESTS 26 358 17612800 1700
131253807 dblark D Oct. 9, 2021, 1:02 a.m. OK GNU C++17 (64) TESTS 26 233 12902400 1700
131233011 generic_placeholder_name D Oct. 8, 2021, 5:58 p.m. OK GNU C++17 (64) TESTS 26 233 14848000 1700
131264717 LacLic D Oct. 9, 2021, 3:23 a.m. OK GNU C++17 (64) TESTS 26 249 20787200 1700
131252622 Acc_Robin D Oct. 9, 2021, 12:26 a.m. OK GNU C++17 (64) TESTS 26 264 7577600 1700
131252301 Life.1s.Suck D Oct. 9, 2021, 12:15 a.m. OK GNU C++17 (64) TESTS 26 264 9523200 1700
131254002 leexzq D Oct. 9, 2021, 1:08 a.m. OK GNU C++17 (64) TESTS 26 265 15564800 1700
131249755 godhands D Oct. 8, 2021, 10:28 p.m. OK GNU C++17 (64) TESTS 26 265 196710400 1700
131273234 Meul D Oct. 9, 2021, 5:34 a.m. OK GNU C++17 (64) TESTS 26 280 7475200 1700
131272426 Meul D Oct. 9, 2021, 5:24 a.m. OK GNU C++17 (64) TESTS 26 280 7475200 1700
131237626 AnandOza D Oct. 8, 2021, 6:39 p.m. OK GNU C++17 (64) TESTS 26 280 9113600 1700
131250998 prezesstefan D Oct. 8, 2021, 11:21 p.m. OK Java 11 TESTS 26 1232 87654400 1700
131266776 naman5811 D Oct. 9, 2021, 4:02 a.m. OK Java 11 TESTS 26 1403 166707200 1700
131248928 Toinfinity D Oct. 8, 2021, 9:58 p.m. OK Java 11 TESTS 26 1435 108544000 1700
131226796 Nicolas125841 D Oct. 8, 2021, 5:09 p.m. OK Java 11 TESTS 26 1512 128102400 1700
131233934 tankman890 D Oct. 8, 2021, 6:04 p.m. OK Java 11 TESTS 26 1762 91033600 1700
131233571 Restricted D Oct. 8, 2021, 6:01 p.m. OK Java 11 TESTS 26 1762 171724800 1700
131253150 7amasa D Oct. 9, 2021, 12:44 a.m. OK Java 11 TESTS 26 1840 147660800 1700
131243205 pili D Oct. 8, 2021, 7:51 p.m. OK Java 11 TESTS 26 2215 224870400 1700
131233766 G.A.T.C D Oct. 8, 2021, 6:02 p.m. OK Java 11 TESTS 26 2308 165990400 1700
131252309 TCchen D Oct. 9, 2021, 12:15 a.m. OK Java 8 TESTS 26 467 21401600 1700
131248836 RonWonWon D Oct. 8, 2021, 9:55 p.m. OK Java 8 TESTS 26 1216 88371200 1700
131231001 Ahmed_Hosssam D Oct. 8, 2021, 5:19 p.m. OK Java 8 TESTS 26 1279 119500800 1700
131230541 Depool D Oct. 8, 2021, 5:18 p.m. OK Java 8 TESTS 26 1310 85196800 1700
131248705 altik_nik D Oct. 8, 2021, 9:51 p.m. OK Java 8 TESTS 26 1403 143462400 1700
131251296 SpargelTarzan D Oct. 8, 2021, 11:35 p.m. OK Java 8 TESTS 26 1575 155852800 1700
131243311 pras7946 D Oct. 8, 2021, 7:53 p.m. OK Java 8 TESTS 26 1793 97484800 1700
131270670 youwot D Oct. 9, 2021, 5 a.m. OK Java 8 TESTS 26 1793 108748800 1700
131269093 Zahid_Hasan_Sahin D Oct. 9, 2021, 4:38 a.m. OK Java 8 TESTS 26 2012 223436800 1700
131239056 Denzed D Oct. 8, 2021, 6:49 p.m. OK Kotlin 1.4 TESTS 26 1278 38707200 1700
131227773 pallav12 D Oct. 8, 2021, 5:12 p.m. OK Kotlin 1.4 TESTS 26 2433 166707200 1700
131236551 r57shell D Oct. 8, 2021, 6:25 p.m. OK MS C++ 2017 TESTS 26 935 37171200 1700
131233083 ILMS D Oct. 8, 2021, 5:58 p.m. OK MS C++ 2017 TESTS 26 966 10137600 1700
131266398 guud222 D Oct. 9, 2021, 3:54 a.m. OK MS C++ 2017 TESTS 26 1060 19558400 1700
131236025 ItsNikolor D Oct. 8, 2021, 6:21 p.m. OK MS C++ 2017 TESTS 26 1153 30208000 1700
131225454 Eldies D Oct. 8, 2021, 5:05 p.m. OK MS C++ 2017 TESTS 26 2557 19148800 1700
131274473 YMSeah D Oct. 9, 2021, 5:47 a.m. OK PyPy 3 TESTS 26 1045 59596800 1700
131246683 beethoven97 D Oct. 8, 2021, 8:58 p.m. OK PyPy 3 TESTS 26 1075 77004800 1700
131246746 beethoven97 D Oct. 8, 2021, 8:59 p.m. OK PyPy 3 TESTS 26 1092 79667200 1700
131244560 madun1999 D Oct. 8, 2021, 8:14 p.m. OK PyPy 3 TESTS 26 1154 59801600 1700
131244777 madun1999 D Oct. 8, 2021, 8:17 p.m. OK PyPy 3 TESTS 26 1201 58265600 1700
131252344 YMSeah D Oct. 9, 2021, 12:16 a.m. OK PyPy 3 TESTS 26 1403 75161600 1700
131246448 beethoven97 D Oct. 8, 2021, 8:53 p.m. OK PyPy 3 TESTS 26 1434 95129600 1700
131269320 sPARTY D Oct. 9, 2021, 4:41 a.m. OK PyPy 3 TESTS 26 1496 105779200 1700
131244670 jano31415 D Oct. 8, 2021, 8:16 p.m. OK PyPy 3 TESTS 26 1497 132710400 1700
131251941 YMSeah D Oct. 9, 2021, 12:03 a.m. OK PyPy 3 TESTS 26 1886 111820800 1700
131241159 r57shell D Oct. 8, 2021, 7:19 p.m. OK Python 3 TESTS 26 1590 70758400 1700
131265861 Spheniscine D Oct. 9, 2021, 3:44 a.m. OK Rust TESTS 26 171 13312000 1700
131247325 ATSTNG D Oct. 8, 2021, 9:12 p.m. OK Rust TESTS 26 499 28160000 1700
131241425 mezzou D Oct. 8, 2021, 7:23 p.m. OK Rust TESTS 26 639 42188800 1700

remove filters

Back to search problems