Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define pb push_back
- #define F first
- #define S second
- #define ll long long
- #define ld long double
- #define endl '\n'
- using namespace std;
- ll p;
- int x1[10000], x2[10000], y1[10000], y2[10000];
- bool z[10000];
- int main() {
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- for(int i = 0; i < 4; ++i) {
- cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
- }
- for(int i = 0; i < 3; ++i) {
- for(int j = 0; j < (4-i); ++j) {
- if ( y1[j] > y1[j + 1] ) {
- p = y1[j];
- y1[j] = y1[j + 1];
- y1[j + 1] = p;
- p = y2[j];
- y2[j] = y2[j + 1];
- y2[j + 1] = p;
- }
- }
- }
- if (y2[1] <= y1[3] && y2[2] <= y1[3] ) {
- cout << "Horizontal" << endl;
- cout << y1[3] << endl;
- return 0;
- }
- for(int i = 0; i < 4; ++i) {
- for(int j = 0; j < (4-i); ++j) {
- if ( x1[j] > x1[j + 1] ) {
- p = x1[j];
- x1[j] = x1[j + 1];
- x1[j + 1] = p;
- p = x2[j];
- x2[j] = x2[j + 1];
- x2[j + 1] = p;
- }
- }
- }
- if (x2[1] <= x1[3] && x2[2] <= x1[3] ) {
- cout << "Vertical" << endl;
- cout << x1[3] << endl;
- return 0;
- }
- cout << "Impossible";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement