当前位置:网站首页>【学习笔记】AGC022
【学习笔记】AGC022
2022-07-23 03:39:00 【仰望星空的蚂蚁】
Shopping
万物皆可构造- 我们只关心最少的趟数
- 显然可以 t [ i ] → t [ i ] m o d 2 L t[i]\to t[i]\bmod 2L t[i]→t[i]mod2L,然后直接加到答案里面
- 显然可以每走到一个商场停留 2 L 2L 2L时间购物,然后走到下一个商场,答案是 n + 1 n+1 n+1
- 还是考虑依次处理每个商场
- 记 l [ i ] = [ t [ i ] ≤ 2 ( L − x [ i ] ) ] l[i]=[t[i]\le 2(L-x[i])] l[i]=[t[i]≤2(L−x[i])]
- r [ i ] = [ t [ i ] ≤ 2 x [ i ] ] r[i]=[t[i]\le 2x[i]] r[i]=[t[i]≤2x[i]]
- 假设 i < j i<j i<j,并且 l [ j ] = r [ i ] = 1 l[j]=r[i]=1 l[j]=r[i]=1,那么我在 2 L 2L 2L的时间内可以先到 j j j商场,购物完后再回到 i i i商场,再从 i i i商场出发
- 注意到如果 l [ i ] = 1 , r [ i ] = 0 l[i]=1,r[i]=0 l[i]=1,r[i]=0,那么 x ≤ L 2 x\le \frac{L}{2} x≤2L
- 如果 l [ i ] = 0 , r [ i ] = 1 l[i]=0,r[i]=1 l[i]=0,r[i]=1,那么 x ≥ L 2 x\ge \frac{L}{2} x≥2L
- 因此只能 l [ i ] = r [ i ] = 1 l[i]=r[i]=1 l[i]=r[i]=1与上述两种点匹配
- 显然 l [ i ] = r [ i ] = 0 l[i]=r[i]=0 l[i]=r[i]=0的情况只能在原地等
- 注意细节,如果 l [ n ] = 1 l[n]=1 l[n]=1的话可以单独把这个点消掉让答案减少 1 1 1
- 复杂度 O ( n ) O(n) O(n)
Snuke and Spells
- 考虑求出一个序列最多的不修改的球的数目
- 如果当前值为 x x x的球保留了 i i i个,那么下一个保留的球的值最多为 x − i x-i x−i
- 显然这个构造是合法的,因为被改变了的球可以任意填坑
- 显然可以暴力 d p dp dp做到单次查询 O ( n ) O(n) O(n)
- 但是这样太慢了考虑继续推性质
- 然后想歪了去推优化 d p dp dp了
- 假设对于值 x x x覆盖区间 [ x − i + 1 , x ] [x-i+1,x] [x−i+1,x]
- 那么能保留的球的数目上界就是区间覆盖的并的长度
- 复杂度 O ( n + q ) O(n+q) O(n+q)
- 说白了还是构造 d p dp dp然后优化
Construction of a tree
万物皆可构造
Sorting a Grid
- 考虑暴力匹配
- 假设我们已经匹配了前 i − 1 i-1 i−1列
- 考虑构造二分图完美匹配
- 证明利用Hall定理+鸽巢原理
- 复杂度 O ( n 4 ) O(n^4) O(n4)
Skolem XOR Tree
万物皆可构造- 考虑菊花图的构造
水逆了呵呵考虑将 1 1 1作为根- 显然不能只挂长为 1 1 1的链
为什么没有想到挂长为 2 2 2的链啊该死- 我们只需要将剩下的点两两配对使得 x ⊕ y = 1 x\oplus y=1 x⊕y=1
- 显然 n n n是奇数就做完了
- 显然 n n n是偶数的话 n = 2 k n=2^k n=2k是无解的
- 显然直接找 lowbit(n) → 1 → n − lowbit(n)+1 \text{lowbit(n)}\to 1\to n-\text{lowbit(n)+1} lowbit(n)→1→n−lowbit(n)+1即可
Two Histograms
边栏推荐
- ARP Spoofing protection of network security
- [C language foundation] 15 bit operation
- How switch statements work
- SSH超市进销存管理系统
- How to do the system security test? Let's talk about it in detail
- Decompile the jar package / class file / modify the jar package using the decompile plug-in of idea
- [summary]
- 目标检测xml文件实现mixup数据增强(修改文件路径直接能用,非常方便)
- leetcode 1074. Number of Submatrices That Sum to Target(和为target的子矩阵个数)
- 博世BOSCH EDI项目案例
猜你喜欢

【MySQL】游标「Cursor」

中小企业的福音来咯!JNPF渐火,助力业务数字化升级

Read write barrier in memory barrier -- concurrency problem

使用IDEA的反编译插件 反编译jar包/class文件/修改jar包

Data middle office, Bi business interview (III): how to choose the right interviewees

EasyCVR平台升级到最新版本v2.5.0,如何同步mysql数据库?

SSH supermarket inventory management system

A concise tutorial for soft exam system architecture designer | reverse engineering

Leetcode-99. restore binary search tree

【C语言基础】14 文件、声明和格式化输入输出
随机推荐
客户至上 | 国产BI领跑者,思迈特软件完成C轮融资
金仓数据库 KingbaseES SQL 语言参考手册 (8. 函数(九))
【C语言基础】15 位运算
九张图纵观加密市场周期规律
L-cysteine modified gold nanoparticles (Cys GNPs) and bovine serum albumin / biotinylated albumin nanoparticles
The technical points of the new project can be guided if necessary
C language flexible array
Nine charts overview the cycle law of encryption Market
金仓数据库 KingbaseES SQL 语言参考手册 (8. 函数(一))
实现城市治理一网统管,必须这 4 个关键技术
L-半胱氨酸修饰的金纳米粒子(Cys-GNPs)和牛血清白蛋白/生物素化白蛋白纳米粒
深入理解MVCC与BufferPool缓存机制
c# 字节数组和类相互转换
How to add an operator in ONEFLOW
Transfer software testing salary 10K | there is food in the hand and a bottom in the heart, which is the truth at all times
Android development learning diary - content provider (cross application database modification)
Self organization is the two-way rush of managers and members
在线问题反馈模块实战(十一):实现图片下载功能
Seven sorts -- detailed explanation of ten thousand words
Airtest脚本的点击位置与点击偏移