题目出处: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. PGSQL基本操作语句

    ; --更新数据 ,,) ; --插入数据 ORDER BY app_name,flag asc/desc ; --查询数据并且排序 offset ; --查询起点0开始查询,返回5条数据 ORDER ...

  2. dp学习笔记(各种dp,比较杂)

    HDU1176 中文题意不多解释了. 建一个二维dp数组,dp[ i ][ j ]表示第 i 秒落在 j 处一个馅饼.我们需要倒着DP,为什么呢,从 0秒,x=5处出发,假如沿数组正着往下走,终点到哪 ...

  3. vue 父子传值,子页面没有实时刷新的问题

    在做高德地图的时候,发现列表点击编辑的时候,地图不能实时更新: <el-form-item label="门店坐标:" :label-width="formLabe ...

  4. 【pwnable.kr】 shellshock

    pwnable从入门到放弃,第五题. ssh shellshock@pwnable.kr -p2222 (pw:guest) 这题主要涉及了一个关于bash的CVE漏洞. 首先还是下载源代码审计一下, ...

  5. FMDB 加入数据库版本信息

    //创建数据库版本表 if (![db tableExists:@"tb_dbInfo"]) { result = [db executeUpdate:@"CREATE ...

  6. 当chart图遇上bootstrap的TAB切换 无宽高问题?

    .tab-content > .tab-pane, .pill-content > .pill-pane {    display: block; /* undo display:none ...

  7. 留学Essay写作做到精准表达很关键

    很多留学生在essay写作中可以迅速想到合理的中文论点.可是,写出来的英文论点却漏洞百出,不忍直视.在essay写作中我们要如何精准地用英文写出自己内心的独白呢?除了咨询老师,靠自己一样能做到! 1引 ...

  8. Python 中异常嵌套

    在Python中,异常也可以嵌套,当内层代码出现异常时,指定异常类型与实际类型不符时,则向外传,如果与外面的指定类型符合,则异常被处理,直至最外层,运用默认处理方法进行处理,即停止程序,并抛出异常信息 ...

  9. mybatis的一对多和多对一的连接查询

    实体类: package com.entity; import java.util.List; public class Dept { private Integer deptId; private ...

  10. PTA天梯赛L2

    L2-001 紧急救援 题意:就是给你一张n<500的图:让你求最短路径,最短路条数,以及路径: 做法,先用dijkstra求最短路,然后dfs找最短路条数,以及点权的最大值: 一般dfs不就可 ...