Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. /*
  2. ┏╗ ┏╗
  3. ║┃ ║┃╔━╦╦┳═╗
  4. ║┃ ┃╚┫║┃┃┃╩┫
  5. ┗╝ ╚━╩═┻━╩━╝
  6. ╔┓╔┓
  7. ║╚┛┣═╦┳╗
  8. ┗╗┏╣┃┃║┃
  9. ┗╝┗═┻═╝
  10. */
  11. #include <bits/stdc++.h>
  12. #define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
  13. #define int long long
  14. #define double long double
  15. #define pii pair<int, int>
  16. #define vi vector <int>
  17. #define vii vector <pii>
  18. #define pb push_back
  19. #define fir first
  20. #define sec second
  21. #define all(x) (x).begin(), (x).end()
  22. #define rall(x) (x).rbegin(), (x).rend()
  23. #define sz(a) signed(a.size())
  24. using namespace std;
  25. const double pi = 3.141592653589793238462643383279;
  26. const int MOD = 998244353;
  27. const int INF = 1e9;
  28. const double eps = 0.000000000000001;
  29. template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }
  30.  
  31. void boot_up() {
  32. #ifdef LOCAL
  33. freopen("input.txt", "r", stdin);
  34. freopen("output.txt", "w", stdout);
  35. #endif
  36. fast;
  37. cout.setf(ios::fixed); cout.precision(15);
  38. }
  39.  
  40. signed main() {
  41. boot_up();
  42. int x_st, y_st, xe, ye, x = 0, y = 0;
  43. cin >> x_st >> y_st;
  44. xe = abs(x_st);
  45. ye = abs(y_st);
  46. vii st;
  47. if (x_st != 0) x_st /= xe;
  48. else x_st = 1;
  49.  
  50. if (y_st != 0) y_st /= ye;
  51. else y_st = 1;
  52.  
  53. while (abs(ye - y) >= 2 || abs(xe - x) >= 2) {
  54. if (abs(xe - x) > abs(ye - y)) {
  55. if (y >= ye) {
  56. st.pb({x + 2, y - 1}); y -= 1; x += 2;
  57. } else {
  58. st.pb({x + 2, y + 1}); y += 1; x += 2;
  59. }
  60. } else {
  61. if (x >= xe) {
  62. st.pb({x - 1, y + 2}); x -= 1; y += 2;
  63. } else {
  64. st.pb({x + 1, y + 2}); x += 1; y += 2;
  65. }
  66. }
  67. }
  68.  
  69. if (x == xe && y == ye - 1) {
  70. st.pb({x + 2, y + 1}); x += 2; y += 1;
  71. st.pb({x - 1, y + 2}); x -= 1; y += 2;
  72. st.pb({xe, ye});
  73. } else if (x == xe - 1 && y == ye) {
  74. st.pb({x + 1, y + 2}); x += 1; y += 2;
  75. st.pb({x + 2, y - 1}); x += 2; y -= 1;
  76. st.pb({xe, ye});
  77. } else if (x == xe - 1 && y == ye - 1) {
  78. st.pb({x + 2, y - 1}); x += 2; y -= 1;
  79. st.pb({xe, ye});
  80. }
  81. for (int i = 0; i < st.size(); i++) {
  82. st[i].fir *= x_st;
  83. st[i].sec *= y_st;
  84. }
  85. for (auto i : st) {
  86. cout << i.fir << " " << i.sec << endl;
  87. }
  88. return 0;
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement