返回顶部
摘要: https://www.acwing.com/problem/content/97/ 看了一下感觉可以暴力做,踩了一些坑终于过了。 cpp include using namespace std; typedef long long ll; int cur; int set_ij(int u, in 阅读全文
posted @ 2019-09-01 00:15 Inko 阅读(218) 评论(0) 推荐(0)
摘要: https://codeforc.es/gym/101982/ A Exam 很显然,要把大家做一样的优先认为大家都是对的,大家做不一样的认为自己是对的。最后假如对方有剩余的题是对的那么就要从中减去。 cpp include using namespace std; int k; char s[10 阅读全文
posted @ 2019-08-31 00:55 Inko 阅读(485) 评论(0) 推荐(0)
摘要: https://codeforc.es/gym/102307 最后5题收尾了,大概率铜。其中有2题是签到手速题。有一题是抄模板的表达式求值,写一个分数类随便过。 比较有趣的是下面的: "G. Graduation" 题意:一共有n门课,每门课有至多1门先修课,没有先修课的用0表示。学习一门课的条件是 阅读全文
posted @ 2019-08-31 00:00 Inko 阅读(652) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/251/ 题意:给一段长度至多40000的序列,每次强制在线访问一段区间[L,R],询问区间的众数(若有多个,输出最小的),询问至多50000次。 思路:lyd给的方法一,一种全新的分块思路。众数不可以通过线段树操控,当然 阅读全文
posted @ 2019-08-28 22:28 Inko 阅读(167) 评论(0) 推荐(0)
摘要: ```cpp include using namespace std; typedef long long ll; const int N = 9; const int MaxN = N N N + 10; const int MaxM = N N 4 + 10; const int maxnode 阅读全文
posted @ 2019-08-28 16:50 Inko 阅读(105) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/100/ cpp include using namespace std; typedef long long ll; void U(ll, ll, int, ll, ll, ll, ll); void D(ll, ll, 阅读全文
posted @ 2019-08-28 16:22 Inko 阅读(190) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/259/ 这道题蛮有趣的。 思路之一,是边带权并查集,相当于给点黑白染色,经过一条边权为1的边则改变一次颜色,规定到根节点边权和为0的为黑色。这样做的时候需要注意,合并两个不同并查集的x,y的时候,需要注意现在的黑白色只是 阅读全文
posted @ 2019-08-28 14:11 Inko 阅读(191) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/152/ 思路:开一个pair栈,第一个元素存字符的种类,第二个元素存“这个字符之后曾经匹配过的最大长度”。 为什么是“这个字符之后”,我也很难说清楚,但是感觉这样是对的。某一次遇到右括号弹栈之后,顺便把栈顶的最大长度也u 阅读全文
posted @ 2019-08-28 11:40 Inko 阅读(215) 评论(0) 推荐(0)
摘要: 实际上并不是主席树……只是有点像。 cpp include using namespace std; typedef long long ll; define mid (l+r 1) //离散化之后的值是大一点的 const int MAXN = 200000 + 5; int T[MAXN], t 阅读全文
posted @ 2019-08-27 13:16 Inko 阅读(212) 评论(0) 推荐(0)
摘要: 一种可以在区间上找名次的数据结构。 cpp include using namespace std; typedef long long ll; namespace Treap { define ls ch[id][0] define rs ch[id][1] const int INF = 214 阅读全文
posted @ 2019-08-26 18:31 Inko 阅读(161) 评论(0) 推荐(0)