题解 | #最小长方形#
最小长方形
https://www.nowcoder.com/practice/dc6a75a15d1948edafa6d63bc8fc2368
#include <iostream> #include <set> using namespace std; int main() { int a, b, tt = 0; set<int> v1, v2; while (cin >> a >> b) { if (a == 0 && b == 0) { tt++; if (tt == 1) { cout << *v1.begin() << " " << *v2.begin() << " " << *v1.rbegin() <<" " << *v2.rbegin() << endl; v1.clear(); v2.clear(); continue; } if (tt == 2) break; } else { tt = 0; v1.insert(a); v2.insert(b); } } }