QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#659582#7857. (-1,1)-SumpleteoldseaWA 0ms3632kbC++231.7kb2024-10-19 20:48:562024-10-19 20:48:58

Judging History

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

  • [2024-10-19 20:48:58]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3632kb
  • [2024-10-19 20:48:56]
  • 提交

answer

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

typedef long long ll;
typedef __int128 i128;
const ll yu = 1e9+7;
const int N = 4e5+10;
using PII=pair<ll,ll>;

ll row[4005]={0};
ll col[4005]={0};

void solve()
{
    ll n;
    cin >> n;
    priority_queue<PII> q;
    vector<vector<ll>> ans(n+1,vector<ll>(n+1,-1));
    vector<vector<ll>> arr(n+1,vector<ll>(n+1,1));
    for (int i=1;i<=n;i++)
    {
        string s;
        cin >> s;
        for (int j=0;j<s.size();j++)
        {
            if (s[j]=='-') row[i]++,col[j+1]++,arr[i][j+1]=-1;
        }
    }
    ll f=1;
    for (int i=1;i<=n;i++)
    {
        ll a;
        cin >> a;
        row[i]+=a;
        if (row[i]>n) f=0;
    }
    for (int i=1;i<=n;i++)
    {
        ll a;cin >> a;
        col[i]+=a;
        if (col[i]>n) f=0;
        q.push({col[i],i});
    }
    if (!f)
    {
        cout << "No\n";
        return;
    }
    for (int i=1;i<=n;i++)
    {
        ll ne=row[i];
        vector<PII> ar;
        while(ne--) ar.push_back(q.top()),q.pop();
        for (int j=0;j<ar.size();j++)
        {
            ll v=ar[j].first;
            ll x=ar[j].second;
            v--;
            ans[i][x]=1;
            if (v>0) q.push({v,x});
        }
    }
    if (q.size()) f=0;
    if (!f)
    {
        cout << "No\n";
    }
    else
    {
        cout << "Yes\n";
        for (int i=1;i<=n;i++)
        {
            for (int j=1;j<=n;j++)
            {
                cout << (ans[i][j]==arr[i][j]);
            }
            cout << endl;
        }
    }
}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t=1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
}
/*

*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3632kb

input:

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

output:

Yes
111
111
111

result:

ok n=3

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3540kb

input:

3
---
-++
+++
-2 -1 0
-2 -1 0

output:

No

result:

wrong answer Jury has the answer but participant has not