Advertisement
ivnikkk

Untitled

Dec 3rd, 2021
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.72 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <cmath>
  5. #include <iomanip>
  6. #include <fstream>
  7. #include <string>
  8. #include <set>
  9. #include <deque>
  10. #include <queue>
  11. #include <map>
  12. #include <bitset>
  13. #include <random>
  14. #include <cassert>
  15. #include <unordered_map>
  16. #include <unordered_set>
  17. using namespace std;
  18. typedef long long              ll;
  19. typedef unsigned long long     ull;
  20. typedef long double            ld;
  21. #define sqrt              sqrtl
  22. #define endl              "\n"
  23. #define all(a)            a.begin(), a.end()
  24. #define allr(a)           a.rbegin(), a.rend()
  25. #define pb                push_back
  26. #define F                 first
  27. #define S                 second
  28.  
  29. void solve() {
  30.     ll x, y;
  31.     cin >> x >> y;
  32.     if ((x + y) & 1)
  33.         cout << -1 << endl;
  34.     else if (x > 0 && x == y) {
  35.         cout << 0 << endl;
  36.     }
  37.     else if (y > -x && y < x) {
  38.         cout << 1 << endl;
  39.         cout << (x + y) / 2 << ' ' << (x + y) / 2 << ' ' << 'H' << endl;
  40.     }
  41.     else if (y > -x) {
  42.         cout << 1 << endl;
  43.         cout << (x + y) / 2 << ' ' << (x + y) / 2 << ' ' << 'V' << endl;
  44.     }
  45.     else if (y < x) {
  46.         cout << 2 << endl;
  47.         cout << 1 << ' ' << 1 << ' ' << 'H';
  48.         cout << endl;
  49.         cout << (x - y) / 2 + 1 << ' ' << 1 - (x - y) / 2 << ' ' << 'V';
  50.         cout<<endl;
  51.     }
  52.     else if (y > x) {
  53.         cout << 2 << endl;
  54.         cout << 1 << ' ' << 1 << ' ' << 'V';
  55.         cout << endl;
  56.         cout << 1 - (y - x) / 2 << ' ' << 1 + (y - x) / 2 << ' ' << 'H';
  57.         cout << endl;
  58.     }
  59. }
  60.  
  61. signed main() {
  62.     ios_base::sync_with_stdio(false);
  63.     cin.tie(nullptr);
  64.     ll t = 1;
  65.     //cin >> t;
  66.     while (t--) {
  67.         solve();
  68.     }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement