QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#874261 | #7857. (-1,1)-Sumplete | hhoppitree | RE | 1ms | 3968kb | C++17 | 1.3kb | 2025-01-27 21:33:41 | 2025-01-27 21:33:42 |
Judging History
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;
}
}
for (int i = 1; i <= n; ++i) {
if (c[i]) return 0 & puts("No");
}
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: 0ms
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: 0
Accepted
time: 0ms
memory: 3968kb
input:
1 - -1 1
output:
No
result:
ok n=1
Test #5:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
1 - 0 0
output:
Yes 0
result:
ok n=1
Test #6:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
20 +-------+-----+++-++ -+-++++----++-++-++- -+++--+---+--+-++--- -+++-+--+----++---+- +++-+-++++++-+-+---+ -++-----+----++++++- +-++--+++++-++-+---- +-+----+---+-+++--+- +++++-+++++----+--+- ------++++---+--++-- ++++--------++++--+- -+-+-++++-+-++-++--+ ---+-++---+-++-++--- +-++++-++----+-+++-- +-+...
output:
Yes 01100011111000111110 10101101010110110010 10000011010001001101 10000111011001110111 01101100000101010001 10010101100101101011 01010000000111100101 10111110111001110010 00000110111000100101 00000000001110111000 00001111111101110001 10100111101010100110 00011001111011011000 10111101101110100000 01...
result:
ok n=20
Test #7:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
100 ++++-+-+--++++++-+--+--++-+-+--+++++-+++---+-+-+-++-+-+++-------+-++--+-++--+--+++++-++-+---+--+--++ -++--++-+-++++-+---++-+-+-+-+-+-+-+-+--+-+--+--+++---+--+-----+-----+-++-++-+-++++++--+-+++-+++-++++ --+---++-++--++-+++-------+--+-++------+-----+--+----++++++++-+--+++++--++--+-+-+++---+--+++-+...
output:
Yes 1110010000111010000001100110001111110111001101011111101100000000101100101100111111100010100010011010 0111011110111001000111000110000010101001011010011100010000000010000010110110110111100110111011100111 0011001001100010111001101010111110000000001001000001011101111110011010001100110011110110011101...
result:
ok n=100
Test #8:
score: -100
Runtime Error
input:
500 --+-+-+-++-----+++--+-+++-+---+-+-------+++--++++++-+--++--+-+-++++-++++--++--+---++--++----++--+---++-++--+-----+-+---++-++++-+++++++---++-++--+-++++-+----++-+++-+++---+--+++-+--++-++--+++++++-+++--+---+---+-+---++-+-+--+-+++-++-----+++-++-+++-+-++--++++++-+-++-+++---++-+++-++----+--+++----++++...