QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#360267 | #7857. (-1,1)-Sumplete | awayyy | WA | 1ms | 6020kb | C++20 | 1.8kb | 2024-03-21 16:35:00 | 2024-03-21 16:35:00 |
Judging History
answer
#include<bits/stdc++.h>
//#define int long long
using namespace std;
using ll = long long;
using ld = double;
const int N = 4005;
const ll mod = 998244353;
const ll inf = 1e18;
int n,f[N][N],a[N][N],c[N],r[N];
void solve(int x,int y)
{
f[x][y]^=1;
r[x]+=a[x][y];
c[y]+=a[x][y];
a[x][y]=-a[x][y];
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
// cout<<fixed<<setprecision(10);
cin>>n;
vector<string>ss(n+1);
for(int i=0;i<n;i++){
cin>>ss[i];
}
for(int i=0;i<n;i++){
cin>>r[i];
r[i]=-r[i];
}
for(int i=0;i<n;i++){
cin>>c[i];
c[i]=-c[i];
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(ss[i][j]=='+')a[i][j]=1;
else a[i][j]=-1;
}
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(a[i][j]==1){
solve(i,j);
}
}
}
// for(int i=0;i<n;i++){
// for(int j=0;j<n;j++){
// cerr<<a[i][j]<<" \n"[j==n-1];
// }
// }
for(int i=0;i<n;i++){
if(c[i]<0||r[i]<0){
cout<<"No";
return 0;
}
}
// for(int i=0;i<n;i++){
// cerr<<r[i]<<" \n"[i==n-1];
// }
// for(int i=0;i<n;i++){
// cerr<<c[i]<<" \n"[i==n-1];
// }
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(r[i]<=0)break;
if(c[j]>0)solve(i,j);
}
}
for(int i=0;i<n;i++){
if(c[i]||r[i]){
cout<<"No";
return 0;
}
}
cout<<"Yes\n";
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cout<<f[i][j];
}
cout<<'\n';
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 5680kb
input:
3 +-+ -++ +-+ 1 1 1 1 -1 3
output:
Yes 001 001 111
result:
ok n=3
Test #2:
score: 0
Accepted
time: 1ms
memory: 5596kb
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: 5648kb
input:
3 +-+ -++ ++- 1 0 2 2 2 -1
output:
No
result:
ok n=3
Test #4:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
1 - -1 1
output:
No
result:
ok n=1
Test #5:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
1 - 0 0
output:
Yes 0
result:
ok n=1
Test #6:
score: -100
Wrong Answer
time: 1ms
memory: 6020kb
input:
20 +-------+-----+++-++ -+-++++----++-++-++- -+++--+---+--+-++--- -+++-+--+----++---+- +++-+-++++++-+-+---+ -++-----+----++++++- +-++--+++++-++-+---- +-+----+---+-+++--+- +++++-+++++----+--+- ------++++---+--++-- ++++--------++++--+- -+-+-++++-+-++-++--+ ---+-++---+-++-++--- +-++++-++----+-+++-- +-+...
output:
No
result:
wrong answer Jury has the answer but participant has not