Raslboyy

693

Feb 5th, 2020
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.08 KB | None | 0 0
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3. #define x first
  4. #define y second
  5. #define mp make_pair
  6.  
  7. using namespace std;
  8.  
  9. typedef pair<int, int> pi;
  10.  
  11. int main() {
  12.  
  13.     int n, w, h;
  14.     cin >> n >> w >> h;
  15.  
  16.     vector<pi> vec(n+4);
  17.     for (int i = 0; i < n; i++) {
  18.         cin >> vec[i].x >> vec[i].y;
  19.     }
  20.     vec[n] = mp(0, 0);
  21.     vec[n+1] = mp(w, h);
  22.     vec[n+2] = mp(0, h);
  23.     vec[n+3] = mp(w, 0);
  24.     n+= 4;
  25.     int res = 0;
  26.     int res_x, res_y;
  27.     for (int i = 0; i < n; i++)
  28.         for (int j = 0; j < n; j++){
  29.             int cur = min(w - vec[i].x, vec[j].y);
  30.  
  31.             for (int k = 0; k < n; k++)
  32.                 if (vec[k].x > vec[i].x && vec[k].y < vec[j].y && (vec[k].x - vec[i].x < cur && -vec[k].y + vec[j].y < cur))
  33.                     cur = min(cur, max(vec[k].x - vec[i].x, -vec[k].y + vec[j].y));
  34.             if (cur > res){
  35.                 res = cur;
  36.                 res_x = vec[i].x;
  37.                 res_y = vec[j].y - cur;
  38.             }
  39.         }
  40.  
  41.  
  42.     cout << res_x <<  " " << res_y << " " << res << "\n";
  43.  
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment