摘要: 这道题是并差集的简单应用 1 #include 2 #include 3 #include 4 #define maxn 100010 5 using namespace std; 6 7 int x[maxn],y[maxn],flag[maxn],f[maxn],t[maxn]; 8 bool vis[maxn]; 9 10 inline int find(int x)11 {12 if(x==f[x]) return x;13 return f[x]=find(f[x]);14 }15 int main()16 {17 int n,m,q;18 s... 阅读全文
posted @ 2014-03-16 23:43 null1019 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 map >t; 8 vector::iterator it; 9 int main()10 {11 int n,x;12 scanf("%d",&n);13 for(int i=1; i<=n; i++)14 {15 scanf("%d",&x);16 t[x].push_back(i);17 }18 int m,r,l;19 scanf... 阅读全文
posted @ 2014-03-16 22:51 null1019 阅读(215) 评论(0) 推荐(0) 编辑