304575: CF870E. Points, Lines and Ready-made Titles
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Points, Lines and Ready-made Titles
题意翻译
在一个平面上有n个不同的点(n给出)。而对于每一个点而言,你可以对它作一条垂直线,也可以作一条水平线,并且也可以不对它进行任何操作。(若有重合的线段则视为一条直线)。请问你能得到多少种不同的图片呢?得出的答案对1000000007(10^9+7)取模。题目描述
You are given $ n $ distinct points on a plane with integral coordinates. For each point you can either draw a vertical line through it, draw a horizontal line through it, or do nothing. You consider several coinciding straight lines as a single one. How many distinct pictures you can get? Print the answer modulo $ 10^{9}+7 $ .输入输出格式
输入格式
The first line contains single integer $ n $ ( $ 1<=n<=10^{5} $ ) — the number of points. $ n $ lines follow. The ( $ i+1 $ )-th of these lines contains two integers $ x_{i} $ , $ y_{i} $ ( $ -10^{9}<=x_{i},y_{i}<=10^{9} $ ) — coordinates of the $ i $ -th point. It is guaranteed that all points are distinct.
输出格式
Print the number of possible distinct pictures modulo $ 10^{9}+7 $ .
输入输出样例
输入样例 #1
4
1 1
1 2
2 1
2 2
输出样例 #1
16
输入样例 #2
2
-1 -1
0 1
输出样例 #2
9