Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

RGB7526 - Тэгшхэм хажуу диагональ

Хоёр хэмжээст квадрат матриц өгөгдөв. Өгөгдсөн квадрат матриц хажуу диагоналынхаа хувьд тэгшхэмтэй бол

YES үгүй бол NO гэж хэвлэ.

Input

Эхний мөрөнд квадрат матрицын хэмжээс n  өгөгдөнө. n<=10.

Дараагийн n мөрөнд n  бүхэл тоо зайгаар тусгаарлагдан өгөгдөнө. Int төрөл.

Output

Тэгшхэмтэй бол YES үгүй бол NO гэж хэвлэ.

Example

Input:
4
1 2 3 4
5 1 7 3
9 0 1 2 
3 9 5 6

Output:
NO

Нэмсэн:Bataa
Огноо:2013-03-12
Хугацааны хязгаарлалт:1s
Эх кодын хэмжээний хязгаарлалт:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Програмчлалын хэлүүд:ADA95 ASM32 BASH BF C NCSHARP CSHARP C++ 4.3.2 CPP C99 CLPS LISP sbcl LISP clisp D ERL FORTRAN HASK ICON ICK JAVA JS-RHINO JULIA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON PYPY3 PYTHON3 RUBY SCALA SCM guile ST TCL WHITESPACE

hide comments
2023-12-10 11:50:10
#include <iostream>

using namespace std;

int main() {
int n ,a[10][10];
cin >> n;

for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> a[i][j];
}
}

for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (a[i][j] != a[n-j-1][n-i-1]) {
cout << "NO";
return 0;
}
}
}

cout << "YES";

return 0;
}
deelii bla
2023-12-05 07:55:33
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <iostream>

using namespace std;

int main()
{
int a=0,b,i,j;
cin >> b;
int z[b][b];
for(i=0;b>i;i++){
for(j=0;b>j;j++){
cin >> z[i][j];
}
}
for(i=0;b>i;i++){
for(j=0;b>j;j++){
if(z[i][j]!=z[b-j-1][b-i-1]){
cout<<"NO";
return 0;
}
}
}
cout<<"YES";

return 0;
}
huul
2022-12-10 07:13:53
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a, s, d, f, g, h, j, k, l, c, z[1000][1000];
cin>>a;
c=0;
for(s=0;s<a;s++){
for(f=0;f<a;f++){
g=0;
cin>>z[f][g];
g++;
}
}
l=a;
for(h=0;h<a;h++){
k=a;
for(j=0;j<a;j++){
if(z[h][j]==z[l][k]){
k--;
c++;
}
else{
cout<<"NO";
break;
}
}
l--;
}
if(c==a*a-1){
cout<<"YES";
}
}

Last edit: 2022-12-10 07:17:57
2021-12-07 12:33:59


Last edit: 2021-12-07 12:36:04
2021-08-15 12:52:53
!

2019-12-27 13:03:45


Last edit: 2019-12-27 13:03:57
2019-12-26 10:35:48
#include <cstdio>

int main()
{
int n,i,j,a[10][10],p=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
scanf("%d",&a[i][j]);
}
}
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if(a[i][j]==a[n+1-j][n+1-i])
{
p++;
}
}
}
if(p==n*n)
{
printf("YES");
}
else printf("NO");
}
//bj 11-4 bodbodbod//
2019-12-06 12:15:02
#include <cstdio>

int main()
{
int n,i,j,a[10][10],p=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
scanf("%d",&a[i][j]);
}
}
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if(a[i][j]==a[n+1-j][n+1-i])
{
p++;
}
}
}
if(p==n*n)
{
printf("YES");
}
else printf("NO");
}

2019-06-14 13:34:36
chi tegsh hem gol daogonali -iig bodson bn
2019-04-03 08:45:07
#include<bits/stdc++.h>
using namespace std;
int i,j,s,l,n,m,t,v,a[100][100];
int main()
{
scanf("%d",&n);
for (i=1; i<=n; i++)
for (j=1; j<=n; j++)
cin>>a[i][j];

for (i=1; i<=n; i++)
{
for (j=1; j<=n; j++)
if(a[i][j]==a[j][i])
s++;
}
if (s==n*n) printf("YES");
else printf("NO");
return 0;
}
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.