当前位置:网站首页>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)
總結
我是構造垃圾
我是找規律小垃圾
边栏推荐
- Technology sharing | interface testing value and system
- Tupu software digital twin | visual management system based on BIM Technology
- ROS安装报错 sudo: rosdep:找不到命令
- 解决 contents have differences only in line separators
- android中常见的面试题,2022金九银十Android大厂面试题来袭
- 2022 the most complete Tencent background automation testing and continuous deployment practice in the whole network [10000 words]
- 从外卖点单浅谈伪需求
- Simple query cost estimation
- MYSQL中 find_in_set() 函数用法详解
- 图扑软件数字孪生智慧风电系统
猜你喜欢

Share: ZTE Yuanhang 30 Pro root unlock BL magick ZTE 7532n 8040n 9041n brush mask original brush package root method Download

Word finds red text word finds color font word finds highlighted formatted text

Oracle日期格式转换 to_date,to_char,to_timetamp 相互转换

Pytorch yolov5 training custom data

You can have both fish and bear's paw! Sky wing cloud elastic bare metal is attractive!

How to quickly advance automated testing? Listen to the personal feelings of the three bat test engineers

SAP 特征 特性 说明

AI open2022 | overview of recommendation systems based on heterogeneous information networks: concepts, methods, applications and resources

AI金榜题名时,MLPerf榜单的份量究竟有多重?

Analysis of postman core functions - parameterization and test report
随机推荐
Redhat7.4 configure Yum software warehouse (rhel7.4)
使用文件和目录属性和属性
Insufficient picture data? I made a free image enhancement software
What is text mining? "Suggested collection"
cf:B. Almost Ternary Matrix【对称 + 找规律 + 构造 + 我是构造垃圾】
瞅一瞅JUC提供的限流工具Semaphore
Overview of video self supervised learning
RPC协议详解
7-2 keep the linked list in order
FCN: Fully Convolutional Networks for Semantic Segmentation
The road of enterprise digital transformation starts from here
China law network joins hands to observe the cloud, and the online system is a full link observable platform
进程间通信(IPC):共享内存
Applet modification style (placeholder, checkbox style)
案例分享|金融业数据运营运维一体化建设
爬虫01-爬虫基本原理讲解
The main thread anr exception is caused by too many binder development threads
企业数字化转型之路,从这里开始
EasyCVR电子地图中设备播放器loading样式的居中对齐优化
EasyCVR授权到期页面无法登录,该如何解决?