| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 (추가 시간 없음) | 1024 MB (추가 메모리 없음) | 42 | 19 | 13 | 65.000% |
Let $p$ and $q$ be two permutations of $\{1,2,\dots ,N\}$.
Similarity graph of $p$ and $q,ドル $S(p,q),ドル is defined as following:
You are given a simple undirected graph $G$ with $N$ labeled vertices, numbered from 1ドル$ to $N$.
Find a pair $(p,q)$ of permutations of $\{1,2,\dots ,N\},ドル satisfying $S(p,q) =G$.
The first line contains one integer, $N$.
The next $N$ lines contain space-separated $N$ integers. The $j$-th integer of the $i$-th line is $E(i,j)$. $E(i,j)$ is 1ドル$ if there is an edge between vertex $i$ and vertex $j,ドル and 0ドル$ otherwise.
If it is impossible to find $p$ and $q$ satisfying the condition, output NO.
Otherwise, output YES on the first line. On the following two lines, output $p$ and $q$. If there are multiple answers, output any.
4 0 1 0 1 1 0 0 0 0 0 0 1 1 0 1 0
YES 1 2 3 4 2 4 1 3
6 0 1 0 1 0 1 1 0 0 0 1 0 0 0 0 1 1 1 1 0 1 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0
NO
University > KAIST > KAIST ICPC Mock Competition > 2022 KAIST 12th ICPC Mock Competition I번
Camp > Petrozavodsk Programming Camp > Winter 2023 > Day 4: KAIST+KOI Contest, Grand Prix of Korea I번