QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#297366 | #7866. Teleportation | ucup-team1525# | WA | 0ms | 3524kb | C++20 | 1.5kb | 2024-01-04 12:31:46 | 2024-01-04 12:31:46 |
Judging History
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