Pagini recente » Cod sursa (job #603920) | Cod sursa (job #1226554) | Cod sursa (job #1016348) | Cod sursa (job #1044536) | Cod sursa (job #3217733)
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ifstream fin("reuniune.in");
ofstream fout("reuniune.out");
struct dreptung {
ll x1, x2, y1, y2;
dreptung() {};
ll perimetru() {
return 2 * ((x2 - x1) + (y2 - y1));
}
ll arie() {
return (x2 - x1) * (y2 - y1);
}
dreptung operator &(dreptung other) {
dreptung rez;
rez.x1 = max(x1, other.x1);
rez.x2 = min(x2, other.x2);
rez.y1 = max(y1, other.y1);
rez.y2 = min(y2, other.y2);
return rez;
}
};
signed main() {
dreptung a, b, c;
cin >> a.x1 >> a.y1 >> a.x2 >> a.y2 >> b.x1 >> b.y1 >> b.x2 >> b.y2 >> c.x1 >> c.y1 >> c.x2 >> c.y2;
cout << a.arie() + b.arie() + c.arie() - (a & b).arie() - (c & b).arie() - (a & c).arie() + ((a & b) & c).arie() << " ";
cout << a.perimetru() + b.perimetru() + c.perimetru() - (a & b).perimetru() - (c & b).perimetru() - (a & c).perimetru() + ((a & b) & c).perimetru() << "\n";
return 0;
}