题目出处:http://codeforces.com/contest/1016/problem/D

#include<iostream>
#define ll long long int
#define inf 0x3f3f3f3f
#define N 1005
using namespace std;
ll a[N],b[N];
ll xn[N][N];
ll n,m;
int main(){ /**/ cin>>n>>m;
ll x = ;
for(int i=;i<n;i++){
cin>>a[i];
x=x^a[i];
}
ll y = ;
for(int i=;i<m;i++){
cin>>b[i];
y=y^b[i];
} if(x==y){
cout<<"YES"<<endl;
}else{
cout<<"NO"<<endl;
return ;
}
x = x^a[];
x = x^b[];
xn[][] = x;
for(int i=;i<m;i++)
xn[][i] = b[i];
for(int i = ;i<n;i++){
xn[i][] = a[i];
}
for(int i=;i<n;i++){
for(int j = ;j<m;j++){
cout<<xn[i][j]<<" ";
}
cout<<endl;
}
return ;
}

要使得矩阵存在,那么行和列的异或一定等于零.,或者说行的异或和等于列的异或和.,之后就直接特性的填充。

1016D.Vasya And The Matrix#矩阵存在的更多相关文章

  1. Educational Codeforces Round 48 (Rated for Div. 2) D 1016D Vasya And The Matrix (构造)

    D. Vasya And The Matrix time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  2. CodeForces - 1016D Vasya And The Matrix

    题面在这里! 很明显二进制每一位都是无关的,所以可以先把原问题简化:给矩阵中的每个位置填入0/1,使得特定行/列有奇数个1,其他行/列有偶数个1. 一个比较好想的方法是对行和列 列出 n+m 个异或方 ...

  3. Vasya And The Matrix CodeForces - 1016D (思维+构造)

    Now Vasya is taking an exam in mathematics. In order to get a good mark, Vasya needs to guess the ma ...

  4. CF 1042 E. Vasya and Magic Matrix

    E. Vasya and Magic Matrix http://codeforces.com/contest/1042/problem/E 题意: 一个n*m的矩阵,每个位置有一个元素,给定一个起点 ...

  5. codeforces1016 D. Vasya And The Matrix(思维+神奇构造)

    D. Vasya And The Matrix time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  6. D. Vasya And The Matrix(Educational Codeforces Round 48)

    D. Vasya And The Matrix time limit per test2 seconds memory limit per test256 megabytes inputstandar ...

  7. 【CSS3】 理解CSS3 transform中的Matrix(矩阵)

    理解CSS3 transform中的Matrix(矩阵) by zhangxinxu from http://www.zhangxinxu.com 本文地址:http://www.zhangxinxu ...

  8. 理解CSS3 transform中的Matrix(矩阵)

    一.哥,我被你吓住了 打架的时候会被块头大的吓住,学习的时候会被奇怪名字吓住(如“拉普拉斯不等式”).这与情感化设计本质一致:界面设计好会让人觉得这个软件好用! 所以,当看到上面“Matrix(矩阵) ...

  9. HDU5015 233 Matrix(矩阵高速幂)

    HDU5015 233 Matrix(矩阵高速幂) 题目链接 题目大意: 给出n∗m矩阵,给出第一行a01, a02, a03 ...a0m (各自是233, 2333, 23333...), 再给定 ...

随机推荐

  1. 洛谷 P1435 回文字串

    题目传送门 解题思路: 就是求一个字符串的最长回文子序列的长度,然后用整个的长度减去最长回文子序列的长度 AC代码: #include<iostream> #include<cstd ...

  2. 后端使用aes 加密

    package com.util; /* import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;*/ import org.apa ...

  3. x++ 与 ++x的区别

    相信在很多编程语言中都会遇见这个问题,这对于刚入编程的人来说可能是相当懵逼了. 老师的官方说法是:操作符在前面先进行自身运算,再进行其他运算:操作符在后面,先进行其他运算再进行自身运算. 反正我这段话 ...

  4. C语言-逃逸字符、类型转换和布尔类型

    C语言-逃逸字符 逃逸字符是用来表达无法印出来的控制字符或者特殊字符,它由一个反斜杠""开头,后面跟上另一个字符,这两个字符合起来,组成一个字符. \b是backspace,在su ...

  5. 《新标准C++程序设计》3.1.1-3.1.3(C++学习笔记5)

    构造函数 1.构造函数的概念和作用 (1)概念 构造函数就是一类特殊的成员函数,其名字和类一样,不写返回值类型(void也不可以写),可以有参数,可以重载. 如果定义类时没写构造函数,则编译器生成一个 ...

  6. Codeforces Round #604 (Div. 2) 部分题解

    链接:http://codeforces.com/contest/1265 A. Beautiful String A string is called beautiful if no two con ...

  7. python学习---format、当前时间

    1.数字格式化   format <  :左对齐 >  :右对齐 a = “随机数是{:>4d}”.format(1)       结果是0001 2.当前时间 import dat ...

  8. POJ 1325 && 1274:Machine Schedule 匈牙利算法模板题

    Machine Schedule Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 12976   Accepted: 5529 ...

  9. 选择排序_python

    def selectdata(ls): for i in range(len(ls)): index=i for j in range(i+1,len(ls)): if ls[j]<ls[ind ...

  10. mysql5.7.21源码安装

    1.下载安装包 MySQL 官方下载地址:https://dev.mysql.com/downloads/mysql/  MySQL 5.7官方安装文档:https://dev.mysql.com/d ...