Codeforces Round #420 (Div. 2), problem: (A) Okabe and Future Gadget Laboratory Solution In C/C++

By |2017-08-06T21:15:36+00:00August 6th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , |

#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; }