首页
Python
Java
IOS
Andorid
NodeJS
JavaScript
HTML5
【
[jzoj 5177] [NOIP2017提高组模拟6.28] TRAVEL 解题报告 (二分)
】的更多相关文章
[jzoj 5177] [NOIP2017提高组模拟6.28] TRAVEL 解题报告 (二分)
题目链接: https://jzoj.net/senior/#main/show/5177 题目: 题解: 首先选出的泡泡怪一定是连续的一段 L,R 然后 L 一定属于虫洞左边界中的某一个 R 也同样是这样的 这样就可以枚举 L 和 R,$O(N)$判断是否可行(显然不可能重复经过某个点),总复杂度 $O(NM^2)$ 我们看到 R<=1e6 选择二分 R 而不是枚举,这样就可以了 #include<algorithm> #include<cstring> #include&…
[jzoj 5178] [NOIP2017提高组模拟6.28] So many prefix? 解题报告(KMP+DP)
题目链接: https://jzoj.net/senior/#main/show/5178 题目: 题解: 我们定义$f[pos]$表示以位置pos为后缀的字符串对答案的贡献,答案就是$\sum_{i=1}^{n} f[i]$ 考虑怎么得到f数组,我们有$f[i]=f[nxt[i]]+[i是偶数]$ 其实蛮显然的,$f[i]$和$f[nxt[i]]$除了多出前缀i这个贡献没什么区别 #include<algorithm> #include<cstring> #include<…
[JZOJ 5852] [NOIP2018提高组模拟9.6] 相交 解题报告 (倍增+LCA)
题目链接: http://172.16.0.132/senior/#main/show/5852 题目: 题目大意: 多组询问,每次询问树上两条链是否相交 题解: 两条链相交并且仅当某一条链的两个端点的LCA在另一个端点上 对于每次询问,我们分别处理出两条链端点的LCA,通过倍增判断是否存在一条链的LCA在另一条链上 #include<algorithm> #include<cstring> #include<cstdio> #include<iostream&g…
[JZOJ5178]【NOIP2017提高组模拟6.28】So many prefix?
Description…
nowcoder(牛客网)提高组模拟赛第一场 解题报告
T1 中位数(二分) 这个题是一个二分(听说是上周atcoder beginner contest的D题???) 我们可以开一个数组b存a,sort然后二分b进行check(从后往前直接遍历check时间复杂度不太对),check的时候把大于等于当前值的设为1,小于当前值的设为-1,然后题目就变成了查询是否有区间的值大于零(因为和它相同的我们也设为了1). 查询的时候维护一个前缀最小值. #include <iostream> #include <cstdio> #include…
JZOJ 5184. 【NOIP2017提高组模拟6.29】Gift
5184. [NOIP2017提高组模拟6.29]Gift (Standard IO) Time Limits: 1000 ms Memory Limits: 262144 KB Detailed Limits Goto ProblemSet Description…
JZOJ 5196. 【NOIP2017提高组模拟7.3】B
5196. [NOIP2017提高组模拟7.3]B Time Limits: 1000 ms Memory Limits: 262144 KB Detailed Limits Goto ProblemSet Description…
JZOJ 5197. 【NOIP2017提高组模拟7.3】C
5197. [NOIP2017提高组模拟7.3]C Time Limits: 1000 ms Memory Limits: 262144 KB Detailed Limits Goto ProblemSet Description…
JZOJ 5195. 【NOIP2017提高组模拟7.3】A
5195. [NOIP2017提高组模拟7.3]A Time Limits: 1000 ms Memory Limits: 262144 KB Detailed Limits Goto ProblemSet Description…
JZOJ 5185. 【NOIP2017提高组模拟6.30】tty's sequence
5185. [NOIP2017提高组模拟6.30]tty's sequence (Standard IO) Time Limits: 1000 ms Memory Limits: 262144 KB Detailed Limits Goto ProblemSet Description…