Pagini recente » Cod sursa (job #1200419) | Cod sursa (job #2789259) | Cod sursa (job #2258941) | Cod sursa (job #976170) | Cod sursa (job #3175376)
#include <bits/stdc++.h>
#define int long long
using namespace std;
ifstream fin("reuniune.in");
ofstream fout("reuniune.out");
struct drept{
int xj,yj,xs,ys;
drept operator * (const drept &other)
{
return {max(xj,other.xj),max(yj,other.yj),min(xs,other.xs),min(ys,other.ys)};
}
int area()
{
if(xs < xj || ys < yj) return 0;
return (xs - xj) * (ys - yj);
}
int perim()
{
if(xs < xj || ys < yj) return 0;
return 2 * (xs - xj) + 2 * (ys - yj);
}
} d[3];
pair<int,int> reuniuni(drept a, drept b, drept c)
{
int aria = a.area() + b.area() + c.area();
aria -= (a*b).area() + (a*c).area() + (b*c).area();
aria += ((a * b) * c) .area();
int perim = a.perim() + b.perim() + c.perim();
perim -= (a*b).perim() + (a*c).perim() + (b*c).perim();
perim += ((a * b) * c) .perim();
return {aria,perim};
}
signed main()
{
for(int i=0; i<3; i++)
{
fin>>d[i].xj>>d[i].yj>>d[i].xs>>d[i].ys;
}
pair<int,int> rasp = reuniuni(d[0],d[1],d[2]);
fout<<rasp.first<<" "<<rasp.second;
return 0;
}