QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#729376#7857. (-1,1)-SumpleteAshbourneWA 1ms5668kbC++231.3kb2024-11-09 17:00:452024-11-09 17:00:46

Judging History

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

  • [2024-11-09 17:00:46]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5668kb
  • [2024-11-09 17:00:45]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N = 4e3 + 10;
int a[N][N], tp[N][N], mp[N][N];
int main(){
	ios::sync_with_stdio(0);
	int n, m;
	cin >> n;
	vector<int> a(n + 1), b(n + 1), c(n + 1), d(n + 1);
	for(int i = 1; i <= n; ++ i)
		for(int j = 1; j <= n; ++ j){
			char ch; cin >> ch;
			if(ch == '+') tp[i][j] = 1;
			else tp[i][j] = 0, a[i] ++, b[j] ++ ;
		}
	int pd1 = 0, pd2 = 0;
	for(int i = 1; i <= n; ++ i){
		int x; cin >> x; a[i] += x;
		if(a[i] < 0){
			cout << "No" << endl;
			return 0;
		}
		c[i] = a[i]; pd1 += a[i];
	}
	for(int i = 1; i <= n; ++ i){
		int x; cin >> x; b[i] += x;
		if(b[i] < 0) {
			cout << "No" << endl;
		}
	    pd2 += b[i];
	}
	if(pd1 != pd2){
		cout << "No" << endl;
		return 0;
	}
	// for(int i = 1; i <= n; ++ i) cout << a[i] << " ";
	// cout << endl;
	// for(int i = 1; i <= n; ++ i) cout << b[i] << " ";
	for(int i = 1; i <= n; ++ i){
		for(int j = 1; j <= n; ++ j){
			if(a[i] && b[j]){
				mp[i][j] = 1;
				a[i] --;
				b[j]--;
				pd1--;
			}
		}
	}
	if(pd1){
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	for(int i = 1; i <= n; ++ i){
		for(int j = 1; j <= n; ++ j){
			if(tp[i][j]){
				cout << (mp[i][j]? 1 : 0); 
			}else cout << (mp[i][j]? 0 : 1);
		}
		cout << endl;
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5668kb

input:

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

output:

No

result:

wrong answer Jury has the answer but participant has not