为什么是错的?求助大佬!
查看原帖
为什么是错的?求助大佬!
661342
righting楼主2022/6/18 16:53
#include <iostream>
#include <cstdio>
#include <stdlib.h>
#include <cstring>
#define ll long long 
using namespace std;
const int maxn=5100;
int mp[maxn][maxn];
struct node
{
    int i,j;
}ans[maxn];
int n;
int cnt=0;
ll t1[maxn],t2[maxn];
int main ()
{
    scanf ("%d",&n);
    bool flag=true;
    for (int i=1;i<=n;i++)
    {
        for (int j=1;j<=n;j++)
        {
            scanf ("%d",&mp[i][j]);
            if (mp[i][j])
            {
            t1[i]+=mp[i][j];
            t2[j]+=mp[i][j];
            }
            if (mp[i][j]==0)
            {
               ans[++cnt].i=i;
               ans[cnt].j=j;
                flag=true;
            }
        }
    }
    if (!flag)
    {
        printf ("Bad Game!");
        return 0;
    }
    else 
    {
        ll tot=0;
        for (int i=1;i<=cnt;i++)
        {
            int x=ans[i].i;
            int y=ans[i].j;
            tot=max(tot,t1[x]+t2[y]);
        }
        printf ("%lld\n",tot);
        return 0;
    }
}

我不明白为什么错了?

2022/6/18 16:53
加载中...