Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ┏╗ ┏╗
- ║┃ ║┃╔━╦╦┳═╗
- ║┃ ┃╚┫║┃┃┃╩┫
- ┗╝ ╚━╩═┻━╩━╝
- ╔┓╔┓
- ║╚┛┣═╦┳╗
- ┗╗┏╣┃┃║┃
- ┗╝┗═┻═╝
- */
- #include <bits/stdc++.h>
- #define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
- #define int long long
- #define double long double
- #define pii pair<int, int>
- #define vi vector <int>
- #define vii vector <pii>
- #define pb push_back
- #define fir first
- #define sec second
- #define all(x) (x).begin(), (x).end()
- #define rall(x) (x).rbegin(), (x).rend()
- #define sz(a) signed(a.size())
- using namespace std;
- const double pi = 3.141592653589793238462643383279;
- const int MOD = 998244353;
- const int INF = 1e9;
- const double eps = 0.000000000000001;
- template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }
- void boot_up() {
- #ifdef LOCAL
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- fast;
- cout.setf(ios::fixed); cout.precision(15);
- }
- signed main() {
- boot_up();
- int x_st, y_st, xe, ye, x = 0, y = 0;
- cin >> x_st >> y_st;
- xe = abs(x_st);
- ye = abs(y_st);
- vii st;
- if (x_st != 0) x_st /= xe;
- else x_st = 1;
- if (y_st != 0) y_st /= ye;
- else y_st = 1;
- while (abs(ye - y) >= 2 || abs(xe - x) >= 2) {
- if (abs(xe - x) > abs(ye - y)) {
- if (y >= ye) {
- st.pb({x + 2, y - 1}); y -= 1; x += 2;
- } else {
- st.pb({x + 2, y + 1}); y += 1; x += 2;
- }
- } else {
- if (x >= xe) {
- st.pb({x - 1, y + 2}); x -= 1; y += 2;
- } else {
- st.pb({x + 1, y + 2}); x += 1; y += 2;
- }
- }
- }
- if (x == xe && y == ye - 1) {
- st.pb({x + 2, y + 1}); x += 2; y += 1;
- st.pb({x - 1, y + 2}); x -= 1; y += 2;
- st.pb({xe, ye});
- } else if (x == xe - 1 && y == ye) {
- st.pb({x + 1, y + 2}); x += 1; y += 2;
- st.pb({x + 2, y - 1}); x += 2; y -= 1;
- st.pb({xe, ye});
- } else if (x == xe - 1 && y == ye - 1) {
- st.pb({x + 2, y - 1}); x += 2; y -= 1;
- st.pb({xe, ye});
- }
- for (int i = 0; i < st.size(); i++) {
- st[i].fir *= x_st;
- st[i].sec *= y_st;
- }
- for (auto i : st) {
- cout << i.fir << " " << i.sec << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement