4 solutions

  • 2
    @ 2026-2-2 9:47:42
    #include<bits/stdc++.h>
    using namespace std;
    const int N=55;
    int a[N][N]; 
    int main()
    {
    	int h,w;
    	cin>>h>>w;
    	for(int i=1;i<=h;i++)
    	{
    		for(int j=1;j<=w;j++)
    		{
    			cin>>a[i][j];
    		}
    	}
    	int cnt=0;
    	for(int i=1;i<=h;i++)
    	{
    		for(int j=1;j<=w;j++)
    		{
    			for(int i1=i;i1<=h;i1++)
    			{
    				for(int j1=j;j1<=w;j1++)
    				{
    					if(a[i][j]+a[i1][j1]>a[i1][j]+a[i][j1])
    					{
    						cnt++;
    					}
    				}
    			}
    		}
    	}
    	if(cnt>0)
    	{
    		cout<<"No"<<endl;
    	}
    	else
    	{
    		cout<<"Yes"<<endl;
    	}
    	 
    }
    
    
    • 1
      @ 2026-6-6 10:24:44

      qqqqqqqqqqqqqqqqqqqwwwwwwwwwwwwwwwwwwwwwwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq

      • 0
        @ 2026-8-17 21:16:32
        #include<bits/stdc++.h>
        using namespace std;
        int n,m;
        long long  a[55][55];
        int main()
        {
        	cin>>n>>m;
        	for(int i=1;i<=n;i++){
        		for(int j=1;j<=m;j++){
        			cin>>a[i][j];
        		}
        	}
        	for(int i=1;i<=n;i++){
        		for(int j=i+1;j<=n;j++){
        			for(int l=1;l<=m;l++){
        				for(int r=l+1;r<=m;r++){
        					if(a[i][l]+a[j][r]>a[j][l]+a[i][r]){
        						cout<<"No";
        						return 0;
        					}
        				}
        			}
        		}
        	}
        	cout<<"Yes";
        	return 0;
        }
        
        • -1
          @ 2026-7-30 20:23:43
          #include <bits/stdc++.h>
          using namespace std;
          const int N=55;
          int a[N][N];
          int main()
          {
          	int h,w;
          	cin>>h>>w;
          	for(int i=1;i<=h;i++)
          	{
          		for(int j=1;j<=w;j++)
          		{
          			cin>>a[i][j];
          		}
          	}
          	int cnt=0;
          	for(int i=1;i<=h;i++)
          	{
          		for(int j=1;j<=w;j++)
          		{
          			for(int i1=i;i1<=h;i1++)
          			{
          				for(int j1=j;j1<=w;j1++)
          				{
          					if(a[i][j]+a[i1][j1]>a[i1][j]+a[i][j1])
          					{
          						cnt++;
          					}
          				}
          			}
          		}
          	}
          	if(cnt>0)
          	{
          		cout<<"No"<<endl;
          	}
          	else
          	{
          		cout<<"Yes"<<endl;
          	}
          	return 0;
          }
          • 1

          Information

          ID
          2628
          Time
          1000ms
          Memory
          256MiB
          Difficulty
          3
          Tags
          # Submissions
          34
          Accepted
          12
          Uploaded By