当前位置:网站首页>cf:B. Almost Ternary Matrix【對稱 + 找規律 + 構造 + 我是構造垃圾】
cf:B. Almost Ternary Matrix【對稱 + 找規律 + 構造 + 我是構造垃圾】
2022-07-05 18:58:00 【白速龍王的回眸】


分析
趨於對稱,由於是2的倍數,所以考慮基本單元2 * 2
1 0 | 0 1
0 1 | 1 0
ABA…
BAB…
…
我們如上定義兩種特殊的2 * 2的A和B
然後就可以構造出來AB交錯的樣子,符合第一第二個實例
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)
總結
我是構造垃圾
我是找規律小垃圾
边栏推荐
- Shang Silicon Valley Shang preferred project tutorial release
- Insufficient picture data? I made a free image enhancement software
- Oracle Chinese sorting Oracle Chinese field sorting
- 视频自监督学习综述
- ICML2022 | 长尾识别中分布外检测的部分和非对称对比学习
- 5. Data access - entityframework integration
- Chinese postman? Really powerful!
- Use QT to traverse JSON documents and search sub objects
- 鱼和熊掌可以兼得!天翼云弹性裸金属一招鲜!
- Web3.0时代来了,看天翼云存储资源盘活系统如何赋能新基建(下)
猜你喜欢

How to automatically install pythn third-party libraries

技术分享 | 常见接口协议解析

AI表现越差,获得奖金越高?纽约大学博士拿出百万重金,悬赏让大模型表现差劲的任务

Summary of six points of MySQL optimization

FCN: Fully Convolutional Networks for Semantic Segmentation

Use of websocket tool

鱼和熊掌可以兼得!天翼云弹性裸金属一招鲜!

cf:B. Almost Ternary Matrix【对称 + 找规律 + 构造 + 我是构造垃圾】

Windows Oracle 开启远程连接 Windows Server Oracle 开启远程连接

How much does the mlperf list weigh when AI is named?
随机推荐
Word查找红色文字 Word查找颜色字体 Word查找突出格式文本
2022 Alibaba Android advanced interview questions sharing, 2022 Alibaba hand Taobao Android interview questions
How to quickly advance automated testing? Listen to the personal feelings of the three bat test engineers
Emqx 5.0 officially released: a single cluster supports 100million mqtt connections
Analysis of postman core functions - parameterization and test report
Pytorch yolov5 training custom data
视频自监督学习综述
Use QT to traverse JSON documents and search sub objects
R语言使用lubridate包处理日期和时间数据实战
7-2 keep the linked list in order
C final review
Idea configuring NPM startup
Find in MySQL_ in_ Detailed explanation of set() function usage
华律网牵手观测云,上线系统全链路可观测平台
The easycvr authorization expiration page cannot be logged in. How to solve it?
How much does the mlperf list weigh when AI is named?
达梦数据库udf实现
Common time complexity
如何写出好代码 - 防御式编程
图扑软件数字孪生智慧风电系统