long int mod=1000000007 ; int main(){ int n;cin>>n; multiset<int> set1; int arr[n]; for(int i=0;i<n;i++){ cin>>arr[i]; set1.insert(arr[i]); } multiset<int> set2=set1;//拷贝一个集合 int count=0; while(set2.size()){//统计现有数量,尽可能找出最长的连续子数组 count...
HackerRank "Array and simple queries" ! The most interesting, flexible and juicy binary tree problem I have ever seen. I learnt it from here:https://codepair.hackerrank.com/paper/5fIoGg74?b=eyJyb2xlIjoiY2FuZGlkYXRlIiwibmFtZSI6IkJsdWVCaXJkMjI0IiwiZW1haWwiOiJoZWFsdGh5dG9ueUBnbWFpbC5jb20...
Codeforces 375D Tree and Queries 数据结构,dsu on tree 题意 给一棵树,每个节点有颜色,给一些查询(k,v),问k及其子树中,出现大于等于v次的颜色有多少种。 思路 dsu on tree。复杂度O(nlog2n),dsu的nlogn加上树状数组的logn。 dsu的过程中用树状数组维护出现t次的颜色的种数。dfs完一个节点处理他的所...
HackerRank "Array and simple queries" ! Tony's Log Algorithms, Distributed System, Machine Learning <2025年3月> 日一二三四五六 2324252627281 2345678 9101112131415 16171819202122 23242526272829 303112345 公告 昵称:Tonix 园龄:14年11个月 粉丝:2 关注:2...