QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#650333#7857. (-1,1)-SumpleteMrlaolu#WA 0ms3820kbC++202.6kb2024-10-18 14:40:502024-10-18 14:40:54

Judging History

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

  • [2024-10-18 14:40:54]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3820kb
  • [2024-10-18 14:40:50]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define ll long long
#define l first
#define r second
using namespace std;
using PII = pair<int,int>;

ll ans[4001][4001]={0};

void solve(){
    ll n;
    cin >> n;
    vector<vector<ll>> arr(n+1);
    vector<ll> nedc(n+1);
    vector<ll> nedl(n+1);
    vector<PII> colomn(n+1);
    vector<PII> lie(n+1);
    for (int i=1;i<=n;i++){
        string s;
        cin >> s;
        ll zheng=0;
        ll fu=0;
        arr[i].resize(n+1,0);
        for (int j=0;j<n;j++)
        {
            char c;
            c=s[j];
            if (c=='+') arr[i][j+1]=1,zheng++;
            else arr[i][j+1]=-1,fu++;
        }
        PII a={fu*-1,zheng};
        colomn[i]=a;
    }
    for (int i=1;i<=n;i++) cin >> nedc[i];
    for (int i=1;i<=n;i++) cin >> nedl[i];
    for (int i=1;i<=n;i++)
    {
        ll zheng=0;
        ll fu=0;
        for (int j=1;j<=n;j++)
        {
            if (arr[j][i]==1) zheng++;
            else fu++;
        }
        PII a={fu*-1,zheng};
        lie[i]=a;
    }
    for (int i=1;i<=n;i++)
    {
        for (int j=1;j<=n;j++)
        {
            ll f=1;
            ll cl=colomn[i].l;
            ll cr=colomn[i].r;
            ll lil=lie[j].l;
            ll lir=lie[j].r;
            if (arr[i][j]==-1)
            {
                cl++;
                lil++;
            }
            else
            {
                cr--;
                lir--;
            }
            if (nedc[i]<cl || nedc[i]>cr || nedl[j]<lil || nedl[j]>lir) f=0;
            if (f)
            {
                ans[i][j]=0;
                colomn[i].l=cl;
                colomn[i].r=cr;
                lie[j].l=lil;
                lie[j].r=lir;
            }
            else
            {
                ans[i][j]=1;
            }
        }
    }
    ll f=1;
    for (int i=1;i<=n;i++)
    {
        ll c=colomn[i].l+colomn[i].r;
        ll li=lie[i].l+lie[i].r;
        if (c!=nedc[i] || li!=nedl[i]){
            f=0;
            break;
        }
    }
    if (f)
    {
        cout << "Yes\n";
        for (int i=1;i<=n;i++)
        {
            for (int j=1;j<=n;j++)
            {
                cout << ans[i][j];
            }
            cout << endl;
        }
    }
    else
    {
        cout << "No\n";
    }
}

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int _ = 1;
    while(_--){
        solve();
    }
}
/*
3
+-+
-++
+-+
1 1 1
1-1 3

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

3
+-+
-++
++-
1 0 2
2 2 -1
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

Yes
001
001
111

result:

ok n=3

Test #2:

score: 0
Accepted
time: 0ms
memory: 3676kb

input:

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

output:

Yes
110
100
000

result:

ok n=3

Test #3:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

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

output:

No

result:

ok n=3

Test #4:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

1
-
-1
1

output:

No

result:

ok n=1

Test #5:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

1
-
0
0

output:

Yes
0

result:

ok n=1

Test #6:

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

input:

20
+-------+-----+++-++
-+-++++----++-++-++-
-+++--+---+--+-++---
-+++-+--+----++---+-
+++-+-++++++-+-+---+
-++-----+----++++++-
+-++--+++++-++-+----
+-+----+---+-+++--+-
+++++-+++++----+--+-
------++++---+--++--
++++--------++++--+-
-+-+-++++-+-++-++--+
---+-++---+-++-++---
+-++++-++----+-+++--
+-+...

output:

No

result:

wrong answer Jury has the answer but participant has not