QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#749781 | #7857. (-1,1)-Sumplete | caiwen | WA | 1ms | 3640kb | C++14 | 1.4kb | 2024-11-15 10:11:01 | 2024-11-15 10:11:01 |
Judging History
answer
#include<bits/stdc++.h>
#define ull unsigned long long
#define ls(k) (k)<<1
#define rs(k) (k)<<1|1
#define debug(x) cout<<#x<<"="<<x<<endl
using namespace std;
const int inf=0x3f3f3f3f;
const int mod=0;
typedef pair<int,int> pii;
#define _ 4003
int r[_],c[_],nr[_],nb[_][_];
pii nc[_];
inline void subtask(){
int n;cin>>n;
for(int i=1;i<=n;i++){
string str;cin>>str;
for(int j=1;j<=n;j++){
if(str[j-1]=='-') nb[i][j]=1,nr[i]--,nc[j].second--;
}
}
for(int i=1;i<=n;i++) cin>>r[i],nr[i]=r[i]-nr[i];
for(int i=1;i<=n;i++) cin>>c[i],nc[i].second=c[i]-nc[i].second,nc[i].first=i;
bool flag=true;
for(int i=1;i<=n;i++){
sort(nc+1,nc+n+1,[](pii x,pii y){return x.second>y.second;});
int p=1;
while(p<=n&&nr[i]){
if(!nc[p].second) p++;
else{
nr[i]--;
nc[p].second--;
nb[i][nc[p].first]=1-nb[i][nc[p].first];
p++;
}
}
if(nr[i]){
flag=false;
break;
}
//debug(a2);
}
if(!flag) cout<<"NO";
else{
cout<<"YES"<<endl;
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++) cout<<nb[i][j]<<' ';
cout<<endl;
}
}
}
signed main(){
ios::sync_with_stdio(false);
int t=1;//cin>>t;
while(t--) subtask();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3640kb
input:
3 +-+ -++ +-+ 1 1 1 1 -1 3
output:
YES 1 1 1 0 0 1 0 0 1
result:
wrong output format Expected EOLN