当前位置:网站首页>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)
總結
我是構造垃圾
我是找規律小垃圾
边栏推荐
- AI表现越差,获得奖金越高?纽约大学博士拿出百万重金,悬赏让大模型表现差劲的任务
- 解决 contents have differences only in line separators
- max31865模块RTD测温注意事项
- IDEA配置npm启动
- 中文版Postman?功能真心强大!
- Windows Oracle 开启远程连接 Windows Server Oracle 开启远程连接
- vs2017 qt的各种坑
- ICML2022 | 长尾识别中分布外检测的部分和非对称对比学习
- Precautions for RTD temperature measurement of max31865 module
- The worse the AI performance, the higher the bonus? Doctor of New York University offered a reward for the task of making the big model perform poorly
猜你喜欢

IDEA配置npm启动

FCN: Fully Convolutional Networks for Semantic Segmentation

Word查找红色文字 Word查找颜色字体 Word查找突出格式文本

达梦数据库udf实现

Low code practice of xtransfer, a cross-border payment platform: how to integrate with other medium-sized platforms is the core

How to write good code defensive programming

Why can't Bi software do correlation analysis? Take you to analyze

视频自监督学习综述

【Autosar 十四 启动流程详解】

SAP feature description
随机推荐
5. Data access - entityframework integration
R语言使用lubridate包处理日期和时间数据实战
什么是文本挖掘 ?「建议收藏」
UDF implementation of Dameng database
[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
2022 latest intermediate and advanced Android interview questions, [principle + practice + Video + source code]
Tianyi cloud understands enterprise level data security in this way
彻底理解为什么网络 I/O 会被阻塞?
What is text mining? "Suggested collection"
Solutions contents have differences only in line separators
进程间通信(IPC):共享内存
Low code practice of xtransfer, a cross-border payment platform: how to integrate with other medium-sized platforms is the core
Deep copy and shallow copy [interview question 3]
Redhat7.4 configure Yum software warehouse (rhel7.4)
What are the cache interfaces of nailing open platform applet API?
7-1 linked list is also simple fina
【历史上的今天】7 月 5 日:Google 之母出生;同一天诞生的两位图灵奖先驱
跨境支付平台 XTransfer 的低代码实践:如何与其他中台融合是核心
The road of enterprise digital transformation starts from here
Simple query cost estimation