https://codeforces.com/contest/1157/problem/G

C++版本一

题解:暴力

/*
*@Author:   STZG
*@Language: C++
*/
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG
#define RI register int
#define endl "\n"
using namespace std;
typedef long long ll;
//typedef __int128 lll;
const int N=200+10;
const int M=100000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-8;
const int INF = 0x3f3f3f3f;
int t,n,m,k,p,u,v;
int ans,cnt,flag,temp,sum;
int a[N][N],b[N][N],c[N],r[N];
char str;
struct node{};
bool sloved(int x,int y){
    memset(b,0,sizeof(b));
    memset(r,0,sizeof(r));
    memset(c,0,sizeof(c));
    for(int i=x;i<=n;i++)
        for(int j=1;j<=m;j++)
            if(i==x&&j<y)b[i][j]=0;
            else b[i][j]=1;
    for(int i=1;i<=n;i++)
        r[i]=a[i][1]^b[i][1]^c[1];
    for(int j=1;j<=m;j++)
        c[j]=a[1][j]^b[1][j]^r[1];
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if((r[i]^c[j])!=(a[i][j]^b[i][j]))return 0;
    return 1;
}
int main()
{
#ifdef DEBUG
	freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
#endif
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    //scanf("%d",&t);
    //while(t--){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            scanf("%d",&a[i][j]);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(sloved(i,j)){
                //cout<<i<<" "<<j<<endl;
                cout<<"YES"<<endl;
                for(int i=1;i<=n;i++)
                    cout<<r[i];
                cout<<endl;
                for(int j=1;j<=m;j++)
                    cout<<c[j];
                cout<<endl;
                return 0;
            }
        }
    }
    cout<<"NO"<<endl;

    //}

#ifdef DEBUG
	printf("Time cost : %lf s\n",(double)clock()/CLOCKS_PER_SEC);
#endif
    //cout << "Hello world!" << endl;
    return 0;
}