QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#749783#7857. (-1,1)-SumpletecaiwenWA 0ms3572kbC++141.4kb2024-11-15 10:12:522024-11-15 10:12:52

Judging History

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

  • [2024-11-15 10:12:52]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3572kb
  • [2024-11-15 10:12:52]
  • 提交

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]<<' ';
            if(i!=n) cout<<endl;
        }
    }
}
signed main(){
    ios::sync_with_stdio(false);
    int t=1;//cin>>t;
    while(t--) subtask();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3572kb

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