# hihoCoder 1552-缺失的拼图

hihoCoder 1552-缺失的拼图

### 输出

```5
0 0 4 5
0 0 3 1
0 1 2 5
3 0 4 5
2 2 3 5```

`2 1 3 2`

```#include<algorithm>
#include<vector>
#include<iostream>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<set>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> Point;
int main() {
//freopen("input.txt", "r", stdin);
int n;
scanf("%d", &n);
map<Point, int> hash;
int a, b, c, d;
while (n--) {
Point left_bottom, right_top;
scanf("%d %d %d %d", &left_bottom.first, &left_bottom.second, &right_top.first, &right_top.second);
Point left_top = Point(left_bottom.first, right_top.second), right_bottom = Point(right_top.first, left_bottom.second);
++hash[left_bottom];
++hash[right_top];
++hash[left_top];
++hash[right_bottom];
}
set<Point> ans;
for (auto p : hash) {
if (p.second % 2 == 1) {
ans.insert(p.first);
}
}
a = c = ans.begin()->first;
b = d = ans.begin()->second;
for (auto p : ans) {
a = min(a, p.first);
b = min(b, p.second);
c = max(c, p.first);
d = max(d, p.second);
}
printf("%d %d %d %d\n", a, b, c, d);
return 0;
}
```

This site uses Akismet to reduce spam. Learn how your comment data is processed.