主题链接:http://acm.hdu.edu.cn/showproblem.php?pid=4915 Parenthese sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 172    Accepted Submission(s): 69 Problem Description bobo found an anc…
题目链接:http://acm.hdu.edu.cn/showproblem.php? pid=4902 Nice boat Time Limit: 30000/15000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 235    Accepted Submission(s): 116 Problem Description There is an old country…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4925 Apple Tree Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 188    Accepted Submission(s): 129 Problem Description I've bought an orchard an…
2019 Multi-University Training Contest 6 http://acm.hdu.edu.cn/contests/contest_show.php?cid=853 1002. Nonsense Time 这题比较神奇...有一个结论是:一个长度为\(n\)的随机排列的最长上升子序列期望长度为\(O(\sqrt n)\). 那么我们考虑倒着删数,每次暴力处理出当前任意一个最长上升子序列,然后删除\(x\)的时候判一下\(x\)在不在当前的序列中,在就重新求一遍,否则不…
2019 Multi-University Training Contest 5 http://acm.hdu.edu.cn/contests/contest_show.php?cid=852 1004. Equation 把所有绝对值的零点排个序,然后解方程就好了. #include<bits/stdc++.h> using namespace std; // #define int long long void read(int &x) { x=0;int f=1;char ch=…
2019 Multi-University Training Contest 4 http://acm.hdu.edu.cn/contests/contest_show.php?cid=851 1001. AND Minimum Spanning Tree 如果\(n\not =2^x-1\)那么答案为\(0\),可以这么构造: 对于\(i\ne 2^x-1\)把\(i\)连向第一个比\(i\)小的\(j\),并且\(i\&j=0\). 否则\(i\)连向\(i+1\),把这两个点绑在一起就好了…
2019 Multi-University Training Contest 3 http://acm.hdu.edu.cn/contests/contest_show.php?cid=850 1004. Distribution of books 考虑二分答案,设当前二分出来的是\(x\). 设\(f_i\)表示前\(i\)个能分成最多的段数,使得每一段和都\(\leqslant x\). 转移显然,枚举一个\(j\),若\(s_i-s_j\leqslant x\)则转移,\(s_i\)表示前…
2019 Multi-University Training Contest 2 http://acm.hdu.edu.cn/contests/contest_show.php?cid=849 1005. Everything Is Generated In Equal Probability 考虑一个随机的排列的逆序对个数,显然对于两个数\(a,b\),他们位置是均匀排布的,也就是说有\(\frac{1}{2}\)的概率成为逆序对,并且是独立的. 所以一个长度为\(n\)的随机排列期望逆序对个…
2019 Multi-University Training Contest 1 http://acm.hdu.edu.cn/contests/contest_show.php?cid=848 1001. Blank 这题我打比赛的时候想到正解了没敢写... 设\(f_{a,b,c,d}\)表示\(\{0,1,2,3\}​\)最后一次出现的位置排序之后的结果,那么每次枚举四种情况转移就好了. 复杂度\(O(Tn^4)\),由于转移的循环除了个\(4!\)的常数所以跑的很快. #include<b…
个人感觉题解的复杂度很玄,参不透,有没有大佬讲解一下- - /* HDU 6102 - GCDispower [ 数论,树状数组] | 2017 Multi-University Training Contest 6 题意: 给定排列 a[N], M 组 L,R 求解 ∑ [ L <= i < j < k <= R ] [ GCD(a[i], a[j]) == a[k] ] * a[k] 限制:N, M <= 1e5 分析: 数论角度一般考虑枚举 k,由于是区间询问,且贡献有…