QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#353372 | #7857. (-1,1)-Sumplete | ucup-team3215 | WA | 0ms | 3808kb | C++23 | 1.5kb | 2024-03-14 05:35:20 | 2024-03-14 05:35:20 |
Judging History
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