QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#756543 | #7857. (-1,1)-Sumplete | Asda111 | WA | 1ms | 6024kb | C++17 | 1.2kb | 2024-11-16 20:51:54 | 2024-11-16 20:52:00 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=4005;
int n;
char a[N][N];
int ans[N][N];
int r[N],c[N];
int tr[N],tc[N];
bool cmp1(int a,int b){
return r[a]>r[b];
}
bool cmp2(int a,int b){
return c[a]>c[b];
}
int main(){
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%s",a[i]);
}
for(int i=0;i<n;i++){
scanf("%d",r+i);
}
for(int i=0;i<n;i++){
scanf("%d",c+i);
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(a[i][j]=='-'){
ans[i][j]=1;
r[i]++;c[j]++;
}
}
}
for(int i=0;i<n;i++){
tr[i]=tc[i]=i;
}
sort(tr,tr+n,cmp1);
sort(tc,tc+n,cmp2);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(r[tr[i]]&&c[tc[j]]){
ans[tr[i]][tc[j]]^=1;
r[tr[i]]--;c[tc[j]]--;
}
}
}
int F=1;
for(int i=0;i<n;i++){
if(r[i]||c[i])F=0;
}
if(F){
printf("YES\n");
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
printf("%d",ans[i][j]);
}
printf("\n");
}
}else{
printf("NO\n");
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 6024kb
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: 6020kb
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: 5916kb
input:
3 +-+ -++ ++- 1 0 2 2 2 -1
output:
NO
result:
ok n=3
Test #4:
score: 0
Accepted
time: 1ms
memory: 5956kb
input:
1 - -1 1
output:
NO
result:
ok n=1
Test #5:
score: 0
Accepted
time: 1ms
memory: 5976kb
input:
1 - 0 0
output:
YES 0
result:
ok n=1
Test #6:
score: -100
Wrong Answer
time: 1ms
memory: 5972kb
input:
20 +-------+-----+++-++ -+-++++----++-++-++- -+++--+---+--+-++--- -+++-+--+----++---+- +++-+-++++++-+-+---+ -++-----+----++++++- +-++--+++++-++-+---- +-+----+---+-+++--+- +++++-+++++----+--+- ------++++---+--++-- ++++--------++++--+- -+-+-++++-+-++-++--+ ---+-++---+-++-++--- +-++++-++----+-+++-- +-+...
output:
NO
result:
wrong answer Jury has the answer but participant has not