1016D.Vasya And The Matrix#矩阵存在
题目出处: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#矩阵存在的更多相关文章
- 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 ...
- CodeForces - 1016D Vasya And The Matrix
题面在这里! 很明显二进制每一位都是无关的,所以可以先把原问题简化:给矩阵中的每个位置填入0/1,使得特定行/列有奇数个1,其他行/列有偶数个1. 一个比较好想的方法是对行和列 列出 n+m 个异或方 ...
- 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 ...
- CF 1042 E. Vasya and Magic Matrix
E. Vasya and Magic Matrix http://codeforces.com/contest/1042/problem/E 题意: 一个n*m的矩阵,每个位置有一个元素,给定一个起点 ...
- 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 ...
- 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 ...
- 【CSS3】 理解CSS3 transform中的Matrix(矩阵)
理解CSS3 transform中的Matrix(矩阵) by zhangxinxu from http://www.zhangxinxu.com 本文地址:http://www.zhangxinxu ...
- 理解CSS3 transform中的Matrix(矩阵)
一.哥,我被你吓住了 打架的时候会被块头大的吓住,学习的时候会被奇怪名字吓住(如“拉普拉斯不等式”).这与情感化设计本质一致:界面设计好会让人觉得这个软件好用! 所以,当看到上面“Matrix(矩阵) ...
- HDU5015 233 Matrix(矩阵高速幂)
HDU5015 233 Matrix(矩阵高速幂) 题目链接 题目大意: 给出n∗m矩阵,给出第一行a01, a02, a03 ...a0m (各自是233, 2333, 23333...), 再给定 ...
随机推荐
- NSPredicate实现数据筛选
一:基本语法 1.什么是NSPredicate apple官方文档这样写的: The NSPredicate class is used to define logical conditions us ...
- oracle查询语句注意事项:
我想查出datatype 不等于1的所有结果,包括空. '; //这条sql查不出datatype为空的数据 发现oracle需要使用 is null .is not null查询空或非空 ' ...
- 谈谈我近一个半月的dp练习
前请提示:https://www.cnblogs.com/caiyishuai/p/9047991.html 配合这篇文章食用风味更佳哦! 首先十分感谢henry_y提供的50道dp练习,链接在这 ...
- UML-设计模式-缓存策略
继续前一章<本地服务容错> 问题:考虑加载内存ProductCatalog缓存和基于LocalProducts文件缓存的可选方案: 一种是惰性初始化(lazy init):当实际读取外部产 ...
- LeetCode刷题笔记(1-9)
LeetCode1-9 本文更多是作为一个习题笔记,没有太多讲解 1.两数之和 题目请点击链接 ↑ 最先想到暴力解法,直接双循环,但是这样复杂度为n平方 public int[] twoSum(int ...
- JAVA基础——使用配置文件
一. 前言 日常我们做项目中,我们经常会遇到这样的情况:由于开发环境和生产环境的不同,项目部署在生产环境之前,有些参数我们并不知道如何取值.例如:数据库链接设定,我们在部署生产环境之前 ...
- Tensorflow——用openpose进行人体骨骼检测
https://blog.csdn.net/eereere/article/details/80176007 参考资料code:https://github.com/ildoonet/tf-pose- ...
- HTTP协议(三):状态码
前言 作者说:在上一节的内容中,HTTP大佬介绍了他是怎么让服务器和用户达成信息交互的,详细的说明了连接建立过程中用到的一些基本的技术原理,包括请求报文响应报文.建立持久化连接用的Cookie技术等内 ...
- chown virtualbox
virtualbox安装 root@cbill-VirtualBox:/# chown --help用法:chown [选项]... [所有者][:[组]] 文件... 或:chown [选项]... ...
- nginx 4层代理配置
1.nginx 从1.9.0版本开始支持四层代理,但做四层代理时 编译需要添加 --with-stream模块 # ./configure --prefix=/usr/local/nginx--us ...