题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5126 思路:支持离线,那么我们可以用两次CDQ分治使四维降为二维,降成二维后排个序用树状数组维护下就好了 实现代码: #include<bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; ; int ans[M],c[M]; struct node { int x,y,z; int kind,id; node(){} no…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5458 Problem Description Given an undirected connected graph G with n nodes and m edges, with possibly repeated edges and/or loops. The stability of connectedness between node u and node v is defined by…
Jam's problem again Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 640 Accepted Submission(s): 210 Problem Description Jam like to solve the problem which on the 3D-axis,given N(1≤N≤100000)…
Pinball Game 3D Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1137 Accepted Submission(s): 477 Problem Description RD is a smart boy and excel in pinball game. However, playing common 2D…
题目链接:[http://acm.split.hdu.edu.cn/showproblem.php?pid=5517] 题意:定义multi_set A<a , d>,B<c , d , e>,C<x , y , z>,给出 A , B ,定义 C = A * B = ={⟨a,c,d⟩∣⟨a,b⟩∈A, ⟨c,d,e⟩∈B and b=e} .求出C之后,求C中一个元素t[i]<a , b , c>是否存在一个元素tmp<x , y , z>使…
链接:https://www.lydsy.com/JudgeOnline/problem.php?id=3295 思路: 可以将这道题看成倒着插入,这样就可以转化成求逆序对数,用CDQ分治降维,正反用树状数组求两遍逆序对就好了. 这道题还可以用在线的树套树或者可持久化线段树来写.. 实现代码: #include<bits/stdc++.h> using namespace std; #define ll long long ; struct node{ int t,x,y; int kind,…
Description P 工厂是一个生产纸箱的工厂.纸箱生产线在人工输入三个参数 n p a , 之后,即可自动化生产三边边长为 (a mod P,a^2 mod p,a^3 mod P) (a^4 mod p,a^5 mod p,a^6 mod P) .... (a^(3n-2) mod p,a^(3n-1) mod p,a^(3n) mod p) 的n个纸箱.在运输这些纸箱时,为了节约空间,必须将它们嵌套堆叠起来.一个纸箱可以嵌套堆叠进另一个纸箱当且仅当它的最短边.次短边和最长边 长度分别…
xiaoxin and his watermelon candy 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5654 Description During his six grade summer vacation, xiaoxin got lots of watermelon candies from his leader when he did his internship at Tencent. Each watermelon cand…