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.
Problems
B'You are given a tournament -- complete directed graph. In one operation you can pick any vertex v and change the direction of all edges with v on one of the ends (i.e all edges u to v change their orientation to v to u and vice versa). You want to make the tournament strongly connected with the smallest possible number of such operations if it is possible. Also, if it is possible, you need to find the number of ways to make this number of operations to make graph strongly connected (two ways are different if for some i vertex that we chose on i -th operation in one way is different from vertex that we chose on i -th operation in another way). You only need to find this value modulo 998 ,244 ,353 . The first line of input contains one integer n ( 3 <= q n <= q 2000 ): the number of vertices in the tournament. Following n lines contain a description of the given tournament, each of them contains a binary string of length n . If j -th character of i -th string is equal to '1 ', then the graph has an edge i to j . It is guaranteed that there are no edges i to i and the graph has exactly one edge among i to j and j to i for different i and j . If it is not possible to convert tournament to strongly connected with the given operations, output "-1". Otherwise, output two integers: the smallest number of operations that you need to make the given graph strongly connected and the number of ways to do this number of operations to make graph strongly connected, modulo 998 ,244 ,353 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
67381107 |
hos.lyric |
D |
Dec. 21, 2019, 4:24 p.m. |
OK |
D |
TESTS |
122 |
764 |
52838400 |
|
3100 |
68430703 |
mlby |
D |
Jan. 9, 2020, 6:41 a.m. |
OK |
GNU C++11 |
TESTS |
123 |
78 |
16179200 |
|
3100 |
67409445 |
WZYYN |
D |
Dec. 22, 2019, 7:44 a.m. |
OK |
GNU C++11 |
TESTS |
122 |
78 |
16179200 |
|
3100 |
68396683 |
yasugongshang |
D |
Jan. 8, 2020, 11:22 a.m. |
OK |
GNU C++11 |
TESTS |
123 |
93 |
512000 |
|
3100 |
67416197 |
Rubblsh12345 |
D |
Dec. 22, 2019, 9:58 a.m. |
OK |
GNU C++11 |
TESTS |
123 |
108 |
4096000 |
|
3100 |
67525649 |
F.J |
D |
Dec. 24, 2019, 1:55 p.m. |
OK |
GNU C++11 |
TESTS |
123 |
109 |
5017600 |
|
3100 |
67875581 |
_twilight |
D |
Dec. 29, 2019, 1:10 p.m. |
OK |
GNU C++11 |
TESTS |
123 |
124 |
512000 |
|
3100 |
67630708 |
cjy2003 |
D |
Dec. 26, 2019, 3:41 a.m. |
OK |
GNU C++11 |
TESTS |
123 |
218 |
20275200 |
|
3100 |
68757807 |
liqing |
D |
Jan. 14, 2020, 8:20 a.m. |
OK |
GNU C++11 |
TESTS |
123 |
234 |
7987200 |
|
3100 |
67411806 |
Hazyknight |
D |
Dec. 22, 2019, 8:36 a.m. |
OK |
GNU C++11 |
TESTS |
123 |
249 |
4096000 |
|
3100 |
68964821 |
withinlover |
D |
Jan. 17, 2020, 4:07 a.m. |
OK |
GNU C++11 |
TESTS |
123 |
249 |
16384000 |
|
3100 |
68481463 |
jijiang |
D |
Jan. 10, 2020, 7:55 a.m. |
OK |
GNU C++14 |
TESTS |
123 |
93 |
4096000 |
|
3100 |
67381041 |
nealchen |
D |
Dec. 21, 2019, 4:23 p.m. |
OK |
GNU C++14 |
TESTS |
122 |
217 |
3993600 |
|
3100 |
67447461 |
cz_xuyixuan |
D |
Dec. 22, 2019, 11:56 p.m. |
OK |
GNU C++14 |
TESTS |
123 |
234 |
23654400 |
|
3100 |
68370367 |
kmjp |
D |
Jan. 7, 2020, 5:30 p.m. |
OK |
GNU C++14 |
TESTS |
123 |
249 |
7270400 |
|
3100 |
67489905 |
TadijaSebez |
D |
Dec. 23, 2019, 6:56 p.m. |
OK |
GNU C++14 |
TESTS |
123 |
249 |
21299200 |
|
3100 |
68122179 |
hitonanode |
D |
Jan. 3, 2020, 1:44 p.m. |
OK |
GNU C++14 |
TESTS |
123 |
249 |
32870400 |
|
3100 |
68122107 |
hitonanode |
D |
Jan. 3, 2020, 1:43 p.m. |
OK |
GNU C++14 |
TESTS |
123 |
264 |
33075200 |
|
3100 |
67462992 |
yan-zp |
D |
Dec. 23, 2019, 9:57 a.m. |
OK |
GNU C++14 |
TESTS |
123 |
265 |
921600 |
|
3100 |
67584555 |
Combi |
D |
Dec. 25, 2019, 7:44 a.m. |
OK |
GNU C++14 |
TESTS |
123 |
280 |
4096000 |
|
3100 |
67404300 |
jo_on |
D |
Dec. 22, 2019, 5:39 a.m. |
OK |
GNU C++14 |
TESTS |
122 |
280 |
7168000 |
|
3100 |
67480711 |
nvmdava |
D |
Dec. 23, 2019, 3:52 p.m. |
OK |
GNU C++17 |
TESTS |
123 |
77 |
7270400 |
|
3100 |
67463150 |
RNS_CUS |
D |
Dec. 23, 2019, 10:01 a.m. |
OK |
GNU C++17 |
TESTS |
123 |
93 |
8192000 |
|
3100 |
67377443 |
nigus |
D |
Dec. 21, 2019, 3:25 p.m. |
OK |
GNU C++17 |
TESTS |
122 |
109 |
74035200 |
|
3100 |
67377243 |
nigus |
D |
Dec. 21, 2019, 3:22 p.m. |
OK |
GNU C++17 |
TESTS |
122 |
109 |
82739200 |
|
3100 |
67359296 |
majk |
D |
Dec. 21, 2019, 12:32 p.m. |
OK |
GNU C++17 |
TESTS |
122 |
124 |
38502400 |
|
3100 |
67445024 |
Xellos |
D |
Dec. 22, 2019, 9:33 p.m. |
OK |
GNU C++17 |
TESTS |
123 |
140 |
4403200 |
|
3100 |
67414723 |
Anachor |
D |
Dec. 22, 2019, 9:30 a.m. |
OK |
GNU C++17 |
TESTS |
123 |
218 |
512000 |
|
3100 |
67374381 |
xumingkuan |
D |
Dec. 21, 2019, 2:44 p.m. |
OK |
GNU C++17 |
TESTS |
122 |
218 |
36659200 |
|
3100 |
67442327 |
Xellos |
D |
Dec. 22, 2019, 7:55 p.m. |
OK |
GNU C++17 |
TESTS |
123 |
233 |
5324800 |
|
3100 |
67496529 |
GreymaneSilverfang |
D |
Dec. 23, 2019, 11:29 p.m. |
OK |
GNU C++17 |
TESTS |
123 |
249 |
3993600 |
|
3100 |
67391693 |
Suzukaze |
D |
Dec. 21, 2019, 8:05 p.m. |
OK |
Java 8 |
TESTS |
122 |
404 |
17203200 |
|
3100 |
67353517 |
gnomina007 |
D |
Dec. 21, 2019, 12:12 p.m. |
OK |
MS C++ 2017 |
TESTS |
122 |
779 |
17305600 |
|
3100 |
remove filters
Back to search problems