#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int lint; typedef long long ll; long long dx[] = {-1,0,1,0}; long long dy[] = {0,-1,0,1}; bool pole[104][104][5][12]; //x,y,otocenie,v prikazu vector mapa; string prikazy; lint n, m; // n je riadok struct usecka{ pair a; pair b; }; ll vzdial(pair& a, pair& b){ return abs(a.first - b.first) + abs(a.second - b.second); } bool v_mape(ll x, ll y){ if(x>=0 && y>=0 && x & usecky){ set::iterator it = usecky.begin(); while(it != usecky.end()){ if(rovnobezne(*it, u)){ usecka t; t.a = (*it).a; t.b = u.a; if(rovnobezne(t,u)){ vector, ll> > vs; vs.push_back(make_pair(u.a,1)); vs.push_back(make_pair(u.b,1)); vs.push_back(make_pair((*it).a,2)); vs.push_back(make_pair((*it).b,2)); sort(vs.begin(), vs.end()); if(vs[0].second != vs[1].second || vs[1].first == vs[2].first){ usecky.erase(it); usecka nov; nov.a = vs[0].first; nov.b = vs[3].first; usecky.insert(nov); return true; } } } it++; } return false; } ostream& operator << (ostream& out, usecka const & a){ out<<"["< usecky, usecky2; char c; ll x, y ,cx = 0, cy = 0; while(n--){ scanf("%c%lld%lld\n",&c,&x,&y); //cout<::iterator it = usecky.begin(); pair najl = make_pair(1000000,100000); while(it != usecky.end()){ najl.first = min(najl.first, it->a.first); najl.first = min(najl.first, it->b.first); najl.second = min(najl.second, it->a.second); najl.second = min(najl.second, it->b.second); it++; } it = usecky2.begin(); pair najl2 = make_pair(1000000,100000); while(it != usecky2.end()){ najl2.first = min(najl2.first, it->a.first); najl2.first = min(najl2.first, it->b.first); najl2.second = min(najl2.second, it->a.second); najl2.second = min(najl2.second, it->b.second); it++; } it = usecky.begin(); set usecky3,usecky4; while(it != usecky.end()){ usecka nov, nov2; nov.a = (*it).b; nov.b = (*it).a; nov.a.first-=najl.first; nov.b.first-=najl.first; nov.a.second-=najl.second; nov.b.second-=najl.second; nov2 = nov; nov2.a = nov.b; nov2.b = nov.a; usecky3.insert(nov); usecky3.insert(nov2); //cout<