摘要:
1671并查集 对于询问删除边之后的连通块 可以倒着加边 最后再倒序输出 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define N 100010 8 int p[N],father[N],a,b,f[N]; 9 int pp[N];10 struct node11 {12 int x,y;13 }ed[N];14 int find(int x)15 {16 if(father[x]!=x)17 father[x] = find(father[x])... 阅读全文
posted @ 2013-09-24 16:56
_雨
阅读(260)
评论(0)
推荐(0)
摘要:
1613高端的东西lower_bounder函数lower_bound()在first和last中的前闭后开区间进行二分查找,返回大于或等于val的第一个元素位置。如果所有元素都小于val,则返回last的位置,且last的位置是越界的然后用map 把数映射成容器 可以简单查询到每个数出现的最前和最后位置 再与给出的L,R相比较 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 #define N 7001010 map >t;11 v 阅读全文
posted @ 2013-09-24 15:36
_雨
阅读(238)
评论(0)
推荐(0)
摘要:
1306URAL真是没水题 以为简单的排序就好了 ME 内存限制很紧 堆排序 或者 STL用堆排序做的 正好复习一下 都忘了 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define N 1250010 8 int a[N]; 9 void adjust(int i,int n)10 {11 int j;12 a[0] = a[i];13 j = 2*i;14 while(ja[j])17 j++;18 if(a... 阅读全文
posted @ 2013-09-24 09:23
_雨
阅读(236)
评论(0)
推荐(0)

浙公网安备 33010602011771号