题目出处: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. POJ 2481:Cows 树状数组

    Cows Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 14906   Accepted: 4941 Description ...

  2. MD5碰撞和MD5值(哈希值)相等

    md5的碰撞 0e开头的md5和原值: s878926199a 0e545993274517709034328855841020 s155964671a 0e342768416822451524974 ...

  3. 电脑连接了HDMI线,电脑没有声音了,原因和解决办法

    我们经常会使用笔记本电脑通过HDMI线外接显示器或者投影仪设备,会遇到笔记本电脑没有声音或者声音很小的问题. 没有声音说明电脑的播放设备(扬声器)设置问题,可以通过查看扬声器情况解决. 如图所示: 需 ...

  4. CodeForces - 748D Santa Claus and a Palindrome (贪心+构造)

    题意:给定k个长度为n的字符串,每个字符串有一个魅力值ai,在k个字符串中选取字符串组成回文串,使得组成的回文串魅力值最大. 分析: 1.若某字符串不是回文串a,但有与之对称的串b,将串a和串b所有的 ...

  5. Idea 中的快捷键(mac)

    Mac键盘符号和修饰键说明 ⌘ Command ⇧ Shift ⌥ Option ⌃ Control ↩︎ Return/Enter ⌫ Delete ⌦ 向前删除键(Fn+Delete) ↑ 上箭头 ...

  6. (转)绝对路径${pageContext.request.contextPath}用法及其与web.xml中Servlet的url-pattern匹配过程

    以系统的一个“添加商品”的功能为例加以说明,系统页面为add.jsp,如图一所示: 图一  添加商品界面 系统的代码目录结构及add.jsp代码如图二所示: 图二   系统的代码目录结构及add.js ...

  7. elasticsearch + springboot 整合

    https://blog.csdn.net/chengyuqiang/article/details/102938266 https://blog.csdn.net/chengyuqiang/arti ...

  8. SQL基础教程(第2版)第3章 聚合与排序:3-2 对表进行分组

    第3章 聚合与排序:3-2 对表进行分组 ● 使用GROUP BY子句可以像切蛋糕那样将表分割.通过使用聚合函数和GROUP BY子句,可以根据“商品种类”或者“登记日期”等将表分割后再进行汇总.● ...

  9. 解决 springweb Filter 读取request body miss body

    package com.lb.demo.listener; import java.io.BufferedReader; import java.io.ByteArrayInputStream; im ...

  10. Cookie的作用范围、设置、创建、获取的方法

    cookie的作用范围 同一浏览器,同一路径 默认情况下, 上级目录设置的cookie,下级目录可以获取到, 而下级目录设置的cookie,上级目录不能获取. 即:在一个页面设置cookie,那么这个 ...