시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 1 | 1 | 1 | 100.000% |
Bobo draws $n$ intervals on the axis, which are conveniently numbered by $1, 2, \dots, n$. As an excellent mathematician, he managed to set all $n$ intervals of length $10^6$.
Then bobo carefully computes $I_{i, j}$, the length of the intersection of intervals $i$ and $j$, and discards all intervals. However, bobo wants to check his calculations and he is eager to know whether the result can be correct.
In another word, determine if there exists $n$ intervals of length $10^6$ providing the same result.
The first line contains an integer $n$ ($1 \leq n \leq 1000$).
Each of the following $n$ lines contains $n$ integers $I_{i, 1}, I_{i, 2}, \dots, I_{i, n}$ ($0 \leq I_{i, j} \leq 10^6$).
Since bobo knows math well, it is guaranteed that $I_{i, j} = I_{j, i}$ and $I_{i, i} = 10^6$.
If for given $I_{i,j}$ it is possible to find at least one appropriate set of intervals, print "Yes
". Otherwise, print "No
".
3 1000000 500000 0 500000 1000000 500000 0 500000 1000000
Yes
3 1000000 500000 500000 500000 1000000 500000 500000 500000 1000000
No