QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#874259#7857. (-1,1)-SumpletehhoppitreeWA 1ms3968kbC++171.2kb2025-01-27 21:32:242025-01-27 21:32:35

Judging History

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

  • [2025-01-27 21:32:35]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3968kb
  • [2025-01-27 21:32:24]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int N = 105;

int a[N][N], b[N], c[N];

signed main() {
    int n; scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        string s; cin >> s, s = ' ' + s;
        for (int j = 1; j <= n; ++j) {
            if (s[j] == '-') a[i][j] = 1, --b[i], --c[j];
            else a[i][j] = 0;
        }
    }
    for (int i = 1; i <= n; ++i) {
        int x; scanf("%d", &x);
        if (x < b[i]) return 0 & puts("No");
        b[i] = x - b[i];
    }
    for (int i = 1; i <= n; ++i) {
        int x; scanf("%d", &x);
        if (x < c[i]) return 0 & puts("No");
        c[i] = x - c[i];
    }
    for (int i = 1; i <= n; ++i) {
        vector< pair<int, int> > pos;
        for (int j = 1; j <= n; ++j) pos.push_back({c[j], j});
        sort(pos.rbegin(), pos.rend());
        if (b[i] > n) return 0 & puts("No");
        for (int j = 0; j < b[i]; ++j) {
            if (!c[pos[j].second]--) return 0 & puts("No");
            a[i][pos[j].second] ^= 1;
        }
    }
    puts("Yes");
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) putchar(a[i][j] + '0');
        puts("");
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3840kb

input:

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

output:

Yes
111
111
111

result:

ok n=3

Test #2:

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

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

input:

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

output:

No

result:

ok n=3

Test #4:

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

input:

1
-
-1
1

output:

Yes
1

result:

wrong answer wrong sum at col 1