SHARE
TWEET

Untitled

a guest Nov 22nd, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #define _USE_MATH_DEFINES
  3. #include <iostream>
  4. #include <cstdlib>
  5. #include <cmath>
  6. #include <algorithm>
  7. #include <map>
  8. #include <string>
  9. #include <stack>
  10. #include <queue>
  11. #include <vector>
  12. #include <set>
  13. #include <iomanip>
  14. #include <unordered_map>
  15. #include <unordered_set>
  16.  
  17. #define fore(i, a, b) for (int i = a; i < (b); i++)
  18. #define fr(i, a, b) for (int i = a - 1; i >= b; i--)
  19. #define fi(i, a, b) for (int i = (a); i < (b); i++)
  20. #define N 200010
  21. #define inf INT32_MAX
  22. #define inf64 INT64_MAX
  23. #define MOD 1000000007
  24.  
  25. using namespace std;
  26.  
  27. typedef long long ll;
  28. typedef long long lol;
  29. typedef pair<int, int> pr;
  30. typedef pair<int, int> pl;
  31.  
  32. class point
  33. {
  34. public:
  35.     double x;
  36.     double y;
  37.     double res;
  38. };
  39.  
  40. bool comp(const point &p1, const point &p2)
  41. {
  42.     return (p1.res > p2.res);
  43. }
  44.  
  45. vector<point> points;
  46.  
  47. int n;
  48.  
  49. double random_double(double dmin, double dmax)
  50. {
  51.     double f = (double)rand() / RAND_MAX;
  52.     return dmin + f * (dmax - dmin);
  53. }
  54.  
  55. double random_double()
  56. {
  57.     return random_double(0, 1);
  58. }
  59.  
  60. void print_random_point()
  61. {
  62.     double px = random_double();
  63.     double py = random_double();
  64.     cout << px << " " << py << endl;
  65. }
  66.  
  67. void print_nearly_point(double x, double y)
  68. {
  69.     int round = n / 3;
  70.     double d = 1.0 / (pow(2, round));
  71.     double px = x + random_double(0, d) - d / 2;
  72.     double py = y + random_double(0, d) - d / 2;
  73.  
  74.     if (px < 0)
  75.         px = 0;
  76.     if (px > 1)
  77.         px = 1;
  78.     if (py < 0)
  79.         py = 0;
  80.     if (py > 1)
  81.         py = 1;
  82.  
  83.     cout << px << " " << py << endl;
  84. }
  85.  
  86. inline void read()
  87. {
  88.  
  89.     cin >> n;
  90.  
  91.     points.resize(n);
  92.  
  93.     fore(i, 0, n)
  94.     {
  95.         double x, y, res;
  96.         cin >> x >> y >> res;
  97.         points[i].res = res;
  98.         points[i].x = x;
  99.         points[i].y = y;
  100.     }
  101. }
  102.  
  103. inline void solve()
  104. {
  105.     if (n == 0)
  106.     {
  107.         cout << 3 << endl;
  108.         print_random_point();
  109.         print_random_point();
  110.         print_random_point();
  111.         return;
  112.     }
  113.     //else
  114.  
  115.     sort(points.rbegin(), points.rend(), comp);
  116.  
  117.     cout << n + 3;
  118.  
  119.     fore(i, 0, n)
  120.     {
  121.         cout << points[i].x << " " << points[i].y << endl;
  122.     }
  123.  
  124.     //рандомная точка
  125.     print_random_point();
  126.     print_nearly_point(points[0].x, points[0].y);
  127.     print_nearly_point(points[1].x, points[1].y);
  128. }
  129.  
  130. int main()
  131. {
  132.     ios_base::sync_with_stdio(false);
  133.     cin.tie(0);
  134.     cout << fixed;
  135.  
  136.     //freopen("input.txt", "r", stdin);
  137.     //freopen("output.txt", "w", stdout);
  138.  
  139.     read();
  140.     solve();
  141. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top