QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#353372#7857. (-1,1)-Sumpleteucup-team3215WA 0ms3808kbC++231.5kb2024-03-14 05:35:202024-03-14 05:35:20

Judging History

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

  • [2024-03-14 05:35:20]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3808kb
  • [2024-03-14 05:35:20]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

int main() {
    cin.tie(0)->sync_with_stdio(false);
    int n;
    cin >> n;
    vector<pair<int, int>> r(n), c(n);
    vector<vector<int>> res(n, vector<int>(n, 0));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            char x;
            cin >> x;
            if (x == '-') {
                r[i].first++, c[j].first++;
                res[i][j] = 1;
            }
        }
    }
    int a = 0, b = 0;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        r[i].first += x;
        r[i].second = i;
        a += r[i].first;
    }
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        c[i].first += x;
        c[i].second = i;
        b += c[i].first;
    }
    if (a != b) {
        cout << "No\n";
        return 0;
    }
    sort(r.begin(), r.end());
    sort(c.rbegin(), c.rend());
    for (int i = 0; i < n; ++i) {
        int cur = 0;
        while (r[i].first) {
            while (cur < n && !c[cur].first) {
                ++cur;
            }
            if (cur == n) {
                cout << "No\n";
                return 0;
            }
            --r[i].first;
            --c[cur].first;
            res[r[i].second][c[cur].second] ^= 1;
            ++cur;
        }
    }
    cout << "Yes\n";
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cout << res[i][j];
        }
        cout << "\n";
    }
    return 0;
}

詳細信息

Test #1:

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

input:

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

output:

Yes
111
001
001

result:

ok n=3

Test #2:

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

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: 3556kb

input:

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

output:

No

result:

ok n=3

Test #4:

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

input:

1
-
-1
1

output:

No

result:

ok n=1

Test #5:

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

input:

1
-
0
0

output:

Yes
0

result:

ok n=1

Test #6:

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

input:

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

output:

No

result:

wrong answer Jury has the answer but participant has not