QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#729376 | #7857. (-1,1)-Sumplete | Ashbourne | WA | 1ms | 5668kb | C++23 | 1.3kb | 2024-11-09 17:00:45 | 2024-11-09 17:00:46 |
Judging History
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