Affiliate Disclosure: This post contains Amazon affiliate links. If you purchase through these links, eBlogarithm may earn a commission at no extra cost to you. Prices and availability are subject to change.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,a[55][55],i,j,k,l,f;
cin>>n;
for(i=0;i<n;i++)
for(j=0;j<n;j++)
cin>>a[i][j];
for(i=0;i<n;i++)
for(j=0;j<n;j++)
{
f=0;
for(k=0;k<n;k++)
for(l=0;l<n;l++)
if(a[i][j]==a[i][k]+a[l][j]||a[i][j]==1)
f=1;
if(!f)
{
cout<<“No\n”;
return 0;
}
}
cout<<“Yes\n”;
return 0;
}
📦 Looking for Codeforces Round 420 Div Problem Okabe? Check the best deals on Amazon.
🛒 Shop Codeforces Round 420 Div Problem Okabe on Amazon
As an Amazon Associate, eBlogarithm earns from qualifying purchases. Prices and availability are subject to change.
Affiliate Disclosure: This post contains Amazon affiliate links. If you purchase through these links, eBlogarithm may earn a commission at no extra cost to you. Prices and availability are subject to change.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,a[55][55],i,j,k,l,f;
cin>>n;
for(i=0;i<n;i++)
for(j=0;j<n;j++)
cin>>a[i][j];
for(i=0;i<n;i++)
for(j=0;j<n;j++)
{
f=0;
for(k=0;k<n;k++)
for(l=0;l<n;l++)
if(a[i][j]==a[i][k]+a[l][j]||a[i][j]==1)
f=1;
if(!f)
{
cout<<“No\n”;
return 0;
}
}
cout<<“Yes\n”;
return 0;
}
📦 Looking for Codeforces Round 420 Div Problem Okabe? Check the best deals on Amazon.
🛒 Shop Codeforces Round 420 Div Problem Okabe on Amazon
As an Amazon Associate, eBlogarithm earns from qualifying purchases. Prices and availability are subject to change.