QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#575850#7857. (-1,1)-SumpletetosaniaWA 1ms5932kbC++141.1kb2024-09-19 17:01:532024-09-19 17:01:54

Judging History

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

  • [2024-09-19 17:01:54]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5932kb
  • [2024-09-19 17:01:53]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long 
const int N=4e3+5;
int T;
inline int read(){
	int al=0,fh=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
	if(ch=='-')
	fh=-1;
	ch=getchar();
	}
	while(ch<='9'&&ch>='0'){
	al=al*10+ch-'0';
	ch=getchar();
	}
	return al*fh;
}
int n,a[N],cho[N][N];
char str[N][N];
struct node
{
	int i,z;
}b[N];
bool cmp(node a,node b){
	return a.z>b.z;
}
signed main(){
	n=read();
	for(int i=0;i<n;i++){
		scanf("%s",str[i]);
	}
	for(int i=1;i<=n;i++){
		a[i]=read();
	}
	for(int i=1;i<=n;i++){
		b[i].z=read();
		b[i].i=i;
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(str[i][j]=='-'){
				a[i+1]++;
				b[j+1].z++;
			}
				
		}
	}
	int ok=1;
	for(int i=1;i<=n;i++){
		sort(b+1,b+n+1,cmp);
		for(int j=1;j<=a[i];j++){
			b[j].z--;
			if(b[j].z<0)
				ok=0;
			cho[i][b[j].i]=1;
		}
	}
	if(ok==0){
		cout<<"No";
	}
	else {
		cout<<"Yes\n";
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if((cho[i+1][j+1]==1&&str[i][j]=='+')||(cho[i+1][j+1]==0&&str[i][j]=='-'))
					cout<<1;
				else cout<<0;
			}
			cout<<endl;
		}
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 5932kb

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: 5844kb

input:

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

output:

No

result:

ok n=3

Test #4:

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

input:

1
-
-1
1

output:

Yes
1

result:

wrong answer wrong sum at col 1