惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
M
MIT News - Artificial intelligence
MyScale Blog
MyScale Blog
博客园_首页
G
Google Developers Blog
博客园 - 【当耐特】
美团技术团队
博客园 - 聂微东
Stack Overflow Blog
Stack Overflow Blog
Vercel News
Vercel News
小众软件
小众软件
博客园 - 司徒正美
雷峰网
雷峰网
T
Tailwind CSS Blog
V
V2EX
博客园 - 三生石上(FineUI控件)
F
Fortinet All Blogs
罗磊的独立博客
量子位
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog

Sehnsucht

记一次博客换图床的过程 观《花束般的恋爱》 读《活过》 东京 旅行篇 亲人逝去 我为什么想养鱼 防止AI爬取你的博客 「monthly 」博客重构 游戏全成就 好看的小说 人生的每一步都不会是浪费-2024年终 「weekly」星期五综合征 「weekly」听播客 杂谈 读《美丽新世界》 「weekly」社交媒体 恶性事件 新世界 「weekly」认知觉醒 美丽新世界 follow 「weekly」独立博客9问题 双十一买书 读《惊呆了!原来这就是社会学》 一次聊天与自我建设 2024-09月记 补番《relife》 树状数组简单理解 lvm简单使用 博客自动发布方案 某公众号废案 fail2ban基本使用 Podman 环境使用 Nginx Proxy Manager 最佳实践 2024-07同学聚会 vps使用podman部署freshrss Gitlab CICD 实践,思考与记录 装备升级:新的PC gitlab局域网搭建流程
2021牛客多校5 H Holding Two
2021-08-06 · via Sehnsucht

链接:https://ac.nowcoder.com/acm/contest/11256/H 来源:牛客网

时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K Special Judge, 64bit IO Format: %lld

题目描述

Given n,mn,m_{}n,m, construct a matrix AA_{}A of size n×mn\times mn×m, whose entries are all either 0 or 1, and no three distinct entries Ai1,j1,Ai2,j2,Ai3,j3A_{i_1,j_1}, A_{i_2,j_2}, A_{i_3,j_3}Ai1,j1,Ai2,j2,Ai3,j3 satisfying that Ai1,j1=Ai2,j2=Ai3,j3,−1≤i1−i2=i2−i3≤1,−1≤j1−j2=j2−j3≤1A_{i_1,j_1} = A_{i_2,j_2} = A_{i_3,j_3}, -1\le i_1-i_2=i_2-i_3\le 1, -1\le j_1-j_2=j_2-j_3\le 1Ai1,j1=Ai2,j2=Ai3,j3,−1≤i1−i2=i2−i3≤1,−1≤j1−j2=j2−j3≤1. If multiple solutions exist, print any one of them. If no solution, print “-1” in one line.

输入描述:

Input only one line containing two integers n,m (1≤n,m≤1000)n, m~(1\le n,m \le 1000)n,m (1≤n,m≤1000).

输出描述:

If solutions exist, print nn_{}n lines each containing a 0101_{}01-string of length mm_{}m, denoting the matrix you construct. If no solution, print "-1" in one line.

示例1

输入

复制

3 3

输出

复制

110
001
100

解释与代码

我们可以构造出 0011 1100 这样重复的数字即可

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <vector>
#include <limits.h>
#include <assert.h>
#include <functional>
#include <numeric>
#include <ctime>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define pb          push_back
#define ppb         pop_back
#define lbnd        lower_bound
#define ubnd        upper_bound
#define endl        '\n'
#define mll         map<ll,ll>
#define msl         map<string,ll>
#define mls         map<ll, string>
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)
#define trav(a, x)  for(auto& a : x)
#define pll         pair<ll,ll>
#define vl          vector<ll>
#define vll         vector<pair<ll, ll>>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define DEBUG       cerr<<"/n>>>I'm Here<<</n"<<endl;
#define display(x)  trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;
#define ini(a)      memset(a,0,sizeof(a))
#define ini2(a,b)   memset(a,b,sizeof(a))
#define rep(i,a,b)  for(int i=a;i<=b;i++)
#define sc          ll T;cin>>T;for(ll Q=1;Q<=T;Q++)
#define lowbit(x)   x&(-x)
#define pr          printf
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define DBG(x) \
    (void)(cout << "L" << __LINE__ \
    << ": " << #x << " = " << (x) << '\n')
#define TIE \
    cin.tie(0);cout.tie(0);\
    ios::sync_with_stdio(false);
//#define long long int

//using namespace __gnu_pbds;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int maxn = 200009;
const ll N = 1000000007;
const ull N2 = 1000000007;

int cb[][10] = {{1,1,0,0},
				{0,0,1,1}};

void solve(){
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cout<<cb[i%2][j%4]; 
		}
		cout<<endl;
	}
	 
}




int main()
{
//	TIE;
//    #ifndef ONLINE_JUDGE
//    freopen ("input.txt","r",stdin);
//    #else
//    #endif
	solve();
//    sc{solve();}
//    sc{cout<<"Case "<<Q<<":"<<endl;solve();}
}