fork download
  1. // #define ONLINE_JUDGE
  2. #include "bits/stdc++.h"
  3. using namespace std;
  4. #if !defined(mhnd01s) || defined(ONLINE_JUDGE)
  5. #define print(...) ((void)0)
  6. #endif
  7. using ll = long long;
  8. void solve();
  9. signed main() {
  10. #ifdef mhnd01s
  11. int x = mt19937(random_device()())()%100;printf("%d\n", x);
  12. freopen("out", "wt", stdout);
  13. #else
  14. cin.tie(0)->sync_with_stdio(0);
  15. #endif
  16. cin.exceptions(cin.failbit);
  17. int t = 1;
  18. cin >> t;
  19. while(t--) {
  20. solve();
  21. if(t) cout << '\n';
  22. }return 0;
  23. }
  24.  
  25. #define X first
  26. #define Y second
  27. void solve() {
  28. int n; cin >> n;
  29. vector<pair<int, int>> v;
  30. while (n--) {
  31. string s;
  32. cin >> s;
  33. if (s.front() == 'p') {
  34. int x, y; cin >> x >> y;
  35. v.emplace_back(x, y);
  36. } else if (s == "c") {
  37. int x, y, r; cin >> x >> y >> r;
  38. v.emplace_back(x+r, y);
  39. v.emplace_back(x-r, y);
  40. v.emplace_back(x, y+r);
  41. v.emplace_back(x, y-r);
  42. } else {
  43. int x, y, i, j; cin >> x >> y >> i >> j;
  44. v.emplace_back(x, y);
  45. v.emplace_back(i, j);
  46. }
  47. }
  48.  
  49. int mnx = 1010, mny = 1010, mxx = -1010, mxy = -1010;
  50. for (auto p : v) {
  51. mnx = min(mnx, p.X);
  52. mxx = max(mxx, p.X);
  53. mny = min(mny, p.Y);
  54. mxy = max(mxy, p.Y);
  55. }
  56.  
  57. cout << mnx << ' ' << mny << ' ' << mxx << ' ' << mxy;
  58. }
  59.  
Success #stdin #stdout 0.01s 5288KB
stdin
3
1
p 3 3 

2
c 10 10 20
c 20 20 10

1
l 0 0 100 20
stdout
3 3 3 3
-10 -10 30 30
0 0 100 20