当前位置:网站首页>【学习笔记】构造
【学习笔记】构造
2022-07-01 00:39:00 【仰望星空的蚂蚁】
没长脑子
构造题大都很新,所以解决它们并不是一件容易的事 。
Nastia and a Beautiful Matrix
出师不利
要使能填的数目最大,大概长这样 。
发现奇数行可以随便填,于是直接莽,然后 wa 了 。
首先判断出众数不能超过 n × ⌈ n 2 ⌉ n\times \lceil\frac{n}{2}\rceil n×⌈2n⌉ 次。
然后观察斜对角线的情况 。
把给的数拍扁成序列 。 出现次数多的先填,众数放在最前面 。
- 填行为奇,列为偶的格子
- 填行为奇,列为奇的格子
- 填行为偶,列为奇的格子
这样填一定合法 。
Off by One
不会。
想到第一步转化了应该就不难 。
如果我们把能消除的点两两连边,这样是求无向图最大边独立集,而且边数是 O(n^2) ,寄 。
如果我们 点转边 ,问题背景就很熟悉了 。
直接跑生成树即可 。
One-Four Overload
构造题(x)
猜结论(v)
把无解判掉后,很容易猜到这题一定有解。
对于四个位置的情况,限制为相邻两点数字不同 。
然后就可以愉快地二分图染色了 。
可以证明没有奇环 。
证明并不困难 。 考虑欧拉回路 。
Johnny Solving
对于无向连通图。
自然而然想到跑 DFS 树。
如果叶节点深度 >=n/k ,那么输出路径。
否则至少有 k 个叶子结点 。考虑对每个叶子结点构造一个环 。
结合入度 >=3 可以做到 。
这题和 Pairs of Pairs 考的都是一个东西 。
边栏推荐
- JS bubble sort and select sort
- Luogu p1144 shortest circuit count
- Oracle data integrity
- 魔王冷饭||#101 魔王解惑数量多与质量;员工管理;高考志愿填报;游戏架构设计
- Tibetan poem PTA
- The quantity and quality of the devil's cold rice 101; Employee management; College entrance examination voluntary filling; Game architecture design
- Implementation of date class
- Bugku CTF daily one question dark cloud invitation code
- 2021电赛F题openmv和K210调用openmv api巡线,完全开源。
- Basic data structure of redis
猜你喜欢

Mindjet mindmanager2022 mind map decompression installer tutorial

5. TPM module initialization

Share your own terminal DIY display banner

Authentication principle of Ranger plug-in

Can JDBC based on openjdk connect to MySQL?

A letter to 5000 fans!

Exercises on recursion in C language

孔乙己第一问之服务通信知多少?

Gavin's insight on the transformer live broadcast course - rasa project's actual banking financial BOT Intelligent Business Dialogue robot system startup, language understanding, dialogue decision-mak

Flutter Error: Cannot run with sound null safety, because the following dependencies don‘t support
随机推荐
Oracle table creation and management
Deployment of mini version message queue based on redis6.0
初识 Flutter 的绘图组件 — CustomPaint
History of deep learning
How to specify the number of cycles in JSTL- How to loop over something a specified number of times in JSTL?
软硬件基础知识学习--小日记(1)
Web interface testing of software testing
最长的可整合子数组的长度
[LeetCode] 爬楼梯【70】
合适的工作就是好工作
Cmu15445 (fall 2019) project 1 - buffer pool details
Fluent JSON serialization deserialization
获取屏幕高度
P4 learning - p4runtime
2022 is half way through. It's hard to make money
Oracle-数据完整性
Docsify building a personal minimalist knowledge warehouse
Search rotation sort array
PyTorch安装并使用gpu加速
C # Generate PPK files in Putty format (passthrough support)