Masala #TW6QFD8JXT
Matritsa
\(N*N\) o'lchamli \(C\) matritsa berilgan. Sizdan shunday \(A\) va \(B\) massivlar mavjudligini tekshirish so'raladiki, bunda har bir \(i,\space j \space (1\leq i,j \leq N)\) juftlik uchun \(C_{i,j}=A_i+B_j\) shart bajarilsin.
Birinchi qatorda \(N\) natural soni. Keyingi \(N\) ta qatorda \(N\) tadan butun son, \(C\) matritsa elementlari.
\(1\leq N \leq 10^3, \space\space 0\leq C_{i,j}\leq10^9.\)
Agar shartni qanoatlantiruvchi \(A\) va \(B\) massivlar mavjud bo'lsa YES, aks holda NO so'zini chop eting.
# | input.txt | output.txt |
---|---|---|
1 |
2 2 4 2 4 |
YES |
2 |
1 1 |
YES |
3 |
3 1 2 3 2 3 4 4 5 6 |
YES |
4 |
3 1 1 1 1 1 1 1 1 1 |
YES |
5 |
3 1 1 1 1 0 1 1 1 1 |
NO |