我是如此水,学校如此水。。。
有的时候错过就是错过了,再也不会回来。
不要认输,因为你的对手可能很垃圾。
视野要开阔
附D水代码
#include <iostream> #include <algorithm> using namespace std; struct rect { long long area; int u, d, l, r; long long get(int y0, int y1, int x0, int x1) { u = max(y0, y1); d = min(y0, y1); l = min(x0, x1); r = max(x0, x1); area = ((long long)u - d) * (r - l); return (y0 == u) && (x0 == l) ? area : 0; } }; int main() { rect a, b, temp; int T, x1, y1, x3, y3, x2, y2, x4, y4; cin >> T; while (T--) { cin >> x1 >> y1 >> x3 >> y3 >> x2 >> y2 >> x4 >> y4; a.get(x1, x2, y1, y2); b.get(x3, x4, y3, y4); x1 = min(a.u, b.u); x2 = max(a.d, b.d); y1 = max(a.l, b.l); y2 = min(a.r, b.r); cout << a.area + b.area - temp.get(x1, x2, y1, y2) << endl; } return 0; }