QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#756554#7857. (-1,1)-SumpleteAsda111WA 1ms6032kbC++171.1kb2024-11-16 20:56:182024-11-16 20:56:18

Judging History

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

  • [2024-11-16 20:56:18]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:6032kb
  • [2024-11-16 20:56:18]
  • 提交

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 t[N];
bool cmp(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++){
        t[i]=i;
    }
    sort(t,t+n,cmp);
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(r[i]&&c[t[j]]){
                ans[i][t[j]]^=1;
                r[i]--;c[t[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");
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 5888kb

input:

3
+-+
-++
+-+
1 1 1
1 -1 3

output:

YES
111
001
001

result:

ok n=3

Test #2:

score: 0
Accepted
time: 1ms
memory: 5884kb

input:

3
---
-++
+++
-2 -1 0
-2 -1 0

output:

YES
110
100
000

result:

ok n=3

Test #3:

score: 0
Accepted
time: 1ms
memory: 5912kb

input:

3
+-+
-++
++-
1 0 2
2 2 -1

output:

NO

result:

ok n=3

Test #4:

score: 0
Accepted
time: 1ms
memory: 5892kb

input:

1
-
-1
1

output:

NO

result:

ok n=1

Test #5:

score: 0
Accepted
time: 1ms
memory: 5964kb

input:

1
-
0
0

output:

YES
0

result:

ok n=1

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 6032kb

input:

20
+-------+-----+++-++
-+-++++----++-++-++-
-+++--+---+--+-++---
-+++-+--+----++---+-
+++-+-++++++-+-+---+
-++-----+----++++++-
+-++--+++++-++-+----
+-+----+---+-+++--+-
+++++-+++++----+--+-
------++++---+--++--
++++--------++++--+-
-+-+-++++-+-++-++--+
---+-++---+-++-++---
+-++++-++----+-+++--
+-+...

output:

NO

result:

wrong answer Jury has the answer but participant has not