QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#297421#7857. (-1,1)-Sumpleteucup-team870#WA 1ms7920kbC++201.7kb2024-01-04 13:48:512024-01-04 13:48:52

Judging History

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

  • [2024-01-04 13:48:52]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:7920kb
  • [2024-01-04 13:48:51]
  • 提交

answer

#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=l; i<=r; i++)
#define per(i,r,l) for(int i=r; i>=l; i--)
#define IOS {cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);}
using namespace std;

typedef long long ll;
typedef pair<int,int> P;

const int N = 4040;

int row[N], col[N], wb[N], rk[N];
char a[4040][4040];
bool ksj[4040][4040];

char tmp[N];

int main() {
    int n; scanf("%d", &n);
    rep (i, 1, n) {
        scanf("%s", tmp+1);
        rep (j, 1, n) {
            if (tmp[j] == '+') a[i][j] = 1;
        }
    }
    rep (i, 1, n) {
        scanf("%d", &row[i]);
    }
    rep (i, 1, n) {
        scanf("%d", &col[i]);
    }
    rep (i, 1, n) {
        rep (j, 1, n) {
            if (!a[i][j]) {
                row[i]++, col[j]++;
                ksj[i][j] = 1;
            }
        }
    }
    int sumS = 0, sumT = 0;
    rep (i, 1, n) {
        if (row[i] < 0 || row[i] > n) goto gg;
        if (col[i] < 0 || col[i] > n) goto gg;
        sumS += row[i], sumT += col[i];
    }
    if (sumS != sumT) goto gg;

    rep (i, 1, n) {
        // if (col[j] < 0) goto gg;
        rep (j, 1, n) {
            if (col[j] < 0) goto gg;
            wb[col[j]]++;
        }
        rep (j, 1, n) wb[j] += wb[j-1];
        rep (j, 1, n) rk[j] = wb[col[j]]--;
        rep (j, 1, n) {
            if (rk[j] >= n - row[i] + 1) {
                col[j]--;
                ksj[i][j] ^= 1;
            }
        }
    }
    rep (j, 1, n) {
        if (col[j] < 0) goto gg;
    }
    puts("Yes");
    rep (i, 1, n) {
        rep (j, 1, n) {
            printf("%d", ksj[i][j]);
        }
        cout << '\n';
    }
    return 0;

    gg:
    puts("No");
    return 0;
}

詳細信息

Test #1:

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

input:

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

output:

Yes
111
001
001

result:

ok n=3

Test #2:

score: 0
Accepted
time: 1ms
memory: 5996kb

input:

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

output:

Yes
110
100
000

result:

ok n=3

Test #3:

score: 0
Accepted
time: 1ms
memory: 5644kb

input:

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

output:

No

result:

ok n=3

Test #4:

score: 0
Accepted
time: 1ms
memory: 3720kb

input:

1
-
-1
1

output:

No

result:

ok n=1

Test #5:

score: 0
Accepted
time: 1ms
memory: 3848kb

input:

1
-
0
0

output:

Yes
0

result:

ok n=1

Test #6:

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

input:

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

output:

No

result:

wrong answer Jury has the answer but participant has not