QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#297366#7866. Teleportationucup-team1525#WA 0ms3524kbC++201.5kb2024-01-04 12:31:462024-01-04 12:31:46

Judging History

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

  • [2024-01-04 12:31:46]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3524kb
  • [2024-01-04 12:31:46]
  • 提交

answer

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

const int N = 4050;
using pii = pair<int, int>;

int n;
char s[N][N];
pii sx[N], sy[N];
short ans[N][N];

int work() {
    sort(sx + 1, sx + n + 1, [](auto x, auto y) {
        return x.first > y.first;
    });
    for (int i = 1; i <= n; i++) {
        int sum = sx[i].first;
        int si = sx[i].second;
        if (sum > n || sum < 0)
            return false;

        sort(sy + 1, sy + n + 1, [](auto x, auto y) {
            return x.first > y.first;
        });

        for (int j = 1; j <= sum; j++) {
            int sj = sy[j].second;
            sy[j].first--;
            ans[si][sj] = 1;
        }
    }
    return true;
}

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
        scanf("%s", s[i] + 1);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &sx[i].first);
        sx[i].second = i;
    }
    for (int i = 1; i <= n; i++) {
        scanf("%d", &sy[i].first);
        sy[i].second = i;
    }

    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++) {
            if (s[i][j] == '-') {
                sx[i].first--;
                sy[j].first--;
            }
        }

    int flag = work();
    if (!flag) {
        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];
            cout << "\n";
        }
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3524kb

input:

4 3
0 1 2 3

output:

Yes
1110
0000
0000
0000

result:

wrong output format Expected integer, but "Yes" found