QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#546348#7857. (-1,1)-Sumpletecyc_43346WA 0ms5664kbC++141.4kb2024-09-03 23:30:442024-09-03 23:30:44

Judging History

你现在查看的是最新测评结果

  • [2024-09-03 23:30:44]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:5664kb
  • [2024-09-03 23:30:44]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

int n;
int mp[5005][5005];
bool f[5005][5005];
int a[5005],b[5005];
bool c[5005];
struct P{
    int v,i;
}p[5005];
void solve()
{
    cin>>n;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            char c;
            cin>>c;
            if(c=='+')
                mp[i][j]=1;
            else mp[i][j]=-1;
        }
    }
    bool flag=0;
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<=n;i++)cin>>b[i];
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(mp[i][j]==-1){
                f[i][j]=1;
                a[i]++;
                b[j]++;
            }
        }
    }
    for(int i=1;i<=n;i++){
        if(a[i]<0||b[i]<0)flag=1;
    }
    if(flag){
        cout<<"No\n";
        return;
    }
    pair<int,int>p[5005];
    for(int i=1;i<=n;i++)p[i].first = b[i],p[i].second=i;
    for(int i=1;i<=n;i++){
        sort(p+1,p+1+n);
        for(int j=n;j>=1&&a[i];j--,a[i]--){
            f[i][p[j].second]^=1;
            if(p[j].first==0){
                cout<<"No\n";
                return;
            }
            p[j].first--;
        }
    }
    cout<<"Yes\n";
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            cout<<f[i][j];
if(j!=n) cout<<" ";
        }
        cout<<endl;
    }
}

int main()
{
    cin.tie(0) -> sync_with_stdio(false);
    solve();
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 5664kb

input:

3
+-+
-++
+-+
1 1 1
1 -1 3

output:

Yes
1 1 1
1 1 1
1 1 1

result:

wrong output format Expected EOLN