当前位置:网站首页>Cf:b. almost Terry matrix [symmetry + finding rules + structure + I am structural garbage]
Cf:b. almost Terry matrix [symmetry + finding rules + structure + I am structural garbage]
2022-07-05 18:59:00 【White speed Dragon King's review】
analysis
Tend to symmetry , Because it is 2 Multiple , So consider basic units 2 * 2
1 0 | 0 1
0 1 | 1 0
ABA…
BAB…
…
We have defined two special 2 * 2 Of A and B
Then it can be constructed AB Staggered appearance , Conform to the first and second examples
ac code
import sys
input = sys.stdin.readline
for _ in range(int(input())):
n, m = list(map(int, input().split()))
# 1 0 | 0 1
# 0 1 | 1 0
# ABA...
# BAB...
# ...
even = [1, 0, 0, 1]
odd = [0, 1, 1, 0]
ans = [[0] * m for _ in range(n)]
for i in range(n):
for j in range(m):
if i % 4 == 0 or i % 4 == 3:
ans[i][j] = even[j % 4]
else:
ans[i][j] = odd[j % 4]
for row in ans:
print(*row)
summary
I'm construction garbage
I'm looking for regular little garbage
边栏推荐
- Chinese postman? Really powerful!
- 中文版Postman?功能真心强大!
- Interprocess communication (IPC): shared memory
- cf:B. Almost Ternary Matrix【对称 + 找规律 + 构造 + 我是构造垃圾】
- Powerful tool for collection processing
- 2022最新大厂Android面试真题解析,Android开发必会技术
- 尚硅谷尚优选项目教程发布
- 深入底层C源码讲透Redis核心设计原理
- 常见时间复杂度
- Mysql database indexing tutorial (super detailed)
猜你喜欢
怎么自动安装pythn三方库
[HCIA cloud] [1] definition of cloud computing, what is cloud computing, architecture and technical description of cloud computing, Huawei cloud computing products, and description of Huawei memory DD
Isprs2022/ cloud detection: cloud detection with boundary nets
Tupu software digital twin | visual management system based on BIM Technology
【历史上的今天】7 月 5 日:Google 之母出生;同一天诞生的两位图灵奖先驱
5年经验Android程序员面试27天,2022程序员进阶宝典
案例分享|金融业数据运营运维一体化建设
Word查找红色文字 Word查找颜色字体 Word查找突出格式文本
Icml2022 | partial and asymmetric comparative learning of out of distribution detection in long tail recognition
决策树与随机森林
随机推荐
Postman核心功能解析 —— 参数化和测试报告
The easycvr authorization expiration page cannot be logged in. How to solve it?
C final review
瞅一瞅JUC提供的限流工具Semaphore
Precautions for RTD temperature measurement of max31865 module
AI Open2022|基于异质信息网络的推荐系统综述:概念,方法,应用与资源
2022 Alibaba Android advanced interview questions sharing, 2022 Alibaba hand Taobao Android interview questions
鱼和熊掌可以兼得!天翼云弹性裸金属一招鲜!
一文读懂简单查询代价估算
从外卖点单浅谈伪需求
Use of websocket tool
为什么 BI 软件都搞不定关联分析?带你分析分析
How to choose the most formal and safe external futures platform?
Ant group open source trusted privacy computing framework "argot": open and universal
vs2017 qt的各种坑
Icml2022 | partial and asymmetric comparative learning of out of distribution detection in long tail recognition
IDEA配置npm启动
Simple query cost estimation
2022最新大厂Android面试真题解析,Android开发必会技术
Benefits of automated testing