시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 (추가 시간 없음) | 1024 MB (추가 메모리 없음) | 16 | 8 | 8 | 61.538% |
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 > 2022 KAIST 12th ICPC Mock Competition I번
Camp > Petrozavodsk Programming Camp > Winter 2023 > Day 4: KAIST+KOI Contest, Grand Prix of Korea I번