QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 256 MB Total points: 100 Hackable ✓

#9246. 支配点

Statistics

$n$ 個の頂点を持つ完全有向グラフ $G$ が与えられます。すべての $v \neq u$ に対して、辺 $(u \to v)$ が存在するか、あるいは $(u \to w)$ かつ $(w \to v)$ を満たす頂点 $w$ が存在する場合、頂点 $u$ を「支配的 (dominating)」であると呼びます。

このグラフにおいて、3 つの異なる支配的な頂点を見つけてください。支配的な頂点が 3 つ未満の場合は NOT FOUND と出力してください。

入力

入力の最初の行には、整数 $n$ ($1 \le n \le 5000$) が含まれます。

続く $n$ 行には、それぞれ二進文字列 $s_i$ が含まれます。$s_u$ の $v$ 番目の文字が $1$ である場合、辺 $(u \to v)$ が存在します。それ以外の場合、そのような辺は存在しません。すべての $1 \le i < j \le n$ に対して $s_{i,j} = 1$ と $s_{j,i} = 1$ のうちちょうど一方が成り立ち、すべての $1 \le i \le n$ に対して $s_{i,i} = 0$ であることが保証されます。

出力

出力の最初の行には、見つけた答えである 3 つの整数 $a, b, c$ を出力してください。支配的な頂点が足りない場合は NOT FOUND と出力してください。

入出力例

入出力例 1

6
011010
000101
010111
100001
010100
100010
3 1 4

入出力例 2

3
011
001
000
NOT FOUND

入出力例 3

3
010
001
100
1 3 2

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.