当前位置:网站首页>【学习笔记】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
边栏推荐
- 软考 系统架构设计师 简明教程 | 需求工程
- 华泰证券可以网上开户吗安全吗
- 【循环语句】
- QT error: error c2039 "value": not a member of "`global namespace"
- 30行自己写并发工具类(Semaphore, CyclicBarrier, CountDownLatch)是什么体验?
- 金仓数据库 KingbaseES SQL 语言参考手册 (8. 函数(三))
- Android development learning diary - content provider (cross application database modification)
- 金仓数据库 KingbaseES SQL 语言参考手册 (8. 函数(七))
- EasyCVR平台升级到最新版本v2.5.0,如何同步mysql数据库?
- 金仓数据库 KingbaseES SQL 语言参考手册 (8. 函数(一))
猜你喜欢

C语言文件操作

图文并茂演示小程序movable-view的可移动范围
![[300 + selected interview questions from big companies continued to share] big data operation and maintenance sharp knife interview question column (VII)](/img/cf/44b3983dd5d5f7b92d90d918215908.png)
[300 + selected interview questions from big companies continued to share] big data operation and maintenance sharp knife interview question column (VII)

Deeply understand mvcc and bufferpool caching mechanism

What is the experience of writing concurrent tool classes (semaphore, cyclicbarrier, countdownlatch) by yourself in line 30?

How to improve browsing security? Teach you to set up a secure browser trust site

How to do the system security test? Let's talk about it in detail

Anaconda 换源以及安装opencv

浏览器怎么导入导出|删除书签,方法步骤来咯

What is per title encoding?
随机推荐
Bosch Bosch EDI project case
Transfer software testing salary 10K | there is food in the hand and a bottom in the heart, which is the truth at all times
Deeply understand mvcc and bufferpool caching mechanism
【VSCODE】当前工作目录非当前文件夹/pathlib打印cwd路径错误
中小企业的福音来咯!JNPF渐火,助力业务数字化升级
使用MindStudio的X2MindSpore工具进行训练脚本转换
error MSB4181: “QtRunWork”任务返回了 false,但未记录错误
C language -- several classic exercises of C language
1.赋值语句
How to improve browsing security? Teach you to set up a secure browser trust site
This tool complements the last kilometer of JMeter performance analysis
Read write barrier in memory barrier -- concurrency problem
QT error: error c2039 "value": not a member of "`global namespace"
How switch statements work
A concise tutorial for soft exam system architecture designer | reverse engineering
内存屏障中的读写屏障——并发问题
GNN-第三方库:PyG(Pytorch Geometric)【基于Pytorch构建的库,可以帮助用户快速构建和训练自己的图神经网络模型】【DeepWalk、LINE、GCN、GAT等】
Leetcode-99. restore binary search tree
金仓数据库 KingbaseES SQL 语言参考手册 (8. 函数(二))
Use reflection to modify the member variable whose modifier is final