Inverse of Rows and Columns
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 DEBUGfreopen("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 DEBUGprintf("Time cost : %lf s\n",(double)clock()/CLOCKS_PER_SEC);
#endif//cout << "Hello world!" << endl;return 0;
}
Inverse of Rows and Columns相关推荐
- CF1157G. Inverse of Rows and Columns
CF1157G. Inverse of Rows and Columns Solution 首先枚举第一行是否变换,再枚举第一行的010101状态,即可确定列变换. 然后对于之后的行变换,从前往后贪心 ...
- pandas使用transpose函数对dataframe进行转置、将dataframe的行和列进行互换(flip the rows and columns in dataframe)
pandas使用transpose函数对dataframe进行转置.将dataframe的行和列进行互换(flip the rows and columns in dataframe) 目录
- Codeforces Round # 555 (Div3)
1157A. Reachable Numbers 给一个数n,每次可以给n加1,得到去除末尾0之后的数,输出总共可以到达多少个数. 按题意直接模拟(出题人说最多答案只有91个). https://co ...
- Excel VBA:引用行和列——Rows属性和Columns属性
操作方法:引用行和列 可用 Rows 属性或 Columns 属性来处理整行或整列.这两个属性返回代表单元格区域的 Range 对象.在下例中,Rows(1) 返回 Sheet1 上的第一行,然后将区 ...
- Go + Excel 学习 Excelize rows.go
Copyright 2016 - 2019 The excelize Authors. 版权所有2016-2019优秀作者. All rights reserved. 保留所有权利. Use of t ...
- python 读取行数据_openpyxl读取所有行数据之rows属性
openpyxl读取一个sheet的所有行数据可以用rows属性,官方文档如下: If you need to iterate through all the rows or columns of a ...
- HUE下载提示The number of resulting rows was too big to be downloaded
目前,我们内部使用hue作为图形界面工具,通过beeswax来连接impala集群进行sql查询.用户反馈在对查询结果使用Excel进行保存之后报错,错误信息如下所示: The number of r ...
- [讨论] Excel表内单元格及区域的说明(range(),cells()) 以及 columns如何用数字选择区域
原文链接:http://club.excelhome.net/thread-1075224-1-1.html ExcelHome 搜到这篇帖子的起源: 我想要选中columns("1:15& ...
- 对于fmri的设计矩阵构造的一个很直观的解释-by 西南大学xulei教授
本程序意在解释这样几个问题:完整版代码在本文的最后. 1.实验的设计如何转换成设计矩阵?2.设计矩阵的每列表示一个刺激条件,如何确定它们?3.如何根据设计矩阵和每个体素的信号求得该体素对刺激的敏感性? ...
最新文章
- Oracle查看SQL执行计划的方式
- java遍历查询的某一列_【jQuery:遍历相同class的所有值,遍历某一列td的值】
- Android模拟多线程下载
- 经典C语言程序100例之二七
- 小猿圈分享使用Java模拟三道门的游戏
- 8086除法指令DIV,IDIV
- react中样式冲突_如何通过React中的样式使您的应用漂亮
- 【干货合集】看完这些干货,再说你因为“怕蛇”,所以学不好Python!
- 远程桌面复制文件到本地磁盘
- bootstrap 模态窗口按钮位置_Bootstrap模态框(modal)垂直居中
- Mac Pro 使用 ll、la、l等ls的别名命令
- IMU、INS、DGPS和POS
- Android安全与隐私相关特性的行为变更分析
- PHP获取当前完整网址加HTTP/HTTPS
- Java-基础篇-03-【选择语句-循环语句-随机数】
- Android网络图片加载三级缓存
- 普通学渣的春招,秋招历程以及实习心路
- android内存显示大小不一样,对Android很重要!手机运行内存真的越大越好吗?
- MediaCodec进行音频合成
- 自动抓取app数据的攻与防
热门文章
- 非word格式文件700015怎么办_vim黑科技--在word/浏览器/excel等环境中使用vim
- 云服务器怎么选系统,云服务器怎么选择操作系统
- seo html空格影响,这一对HTML标签嵌套对SEO优化的影响,居然99%的人不知道!
- Java是否为整数_Java问题 输入一个数判定其是否为整数
- python单例类命名_单例模式(java/python/c++)
- zk服务器系统,windows系统搭建zookeeper服务器的教程
- c语言删增,C语言中初始、增加和删除进程信号的操作方法简介
- java8之前_Java 8 之前的时间处理
- kali2018安装教程_Kali Linux + Windows10双系统安装教程
- cesium js 路径_Cesium开发学习路径