Advertisement
ivnikkk

Untitled

Dec 3rd, 2021
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 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 (y>>x > 0 && x == y) {
  35. cout << 0 << endl;
  36. }
  37. else if (y > -x) {
  38. cout << 1 << endl;
  39. if(y>x)
  40. cout << (x + y) / 2 << ' ' << (x + y) / 2 << ' ' << 'H' << endl;
  41. else
  42. cout << (x + y) / 2 << ' ' << (x + y) / 2 << ' ' << 'V' << endl;
  43. }
  44. else if (y < x) {
  45. cout << 2 << endl;
  46. cout << 1 << ' ' << 1 << ' ' << 'H';
  47. cout << endl;
  48. cout << (x - y) / 2 + 1 << ' ' << 1 - (x - y) / 2 << ' ' << 'V';
  49. cout<<endl;
  50. }
  51. else if (y > x) {
  52. cout << 2 << endl;
  53. cout << 1 << ' ' << 1 << ' ' << 'V';
  54. cout << endl;
  55. cout << 1 - (y - x) / 2 << ' ' << 1 + (y - x) / 2 << ' ' << 'H';
  56. cout << endl;
  57. }
  58. else {
  59. cout << 3 << endl;
  60. cout << 1 << ' ' << 1 << ' ' << 'H';
  61. cout << endl;
  62. cout << 2 << ' ' << 0 << ' ' << 'V';
  63. cout << endl;
  64. cout << x + 1 << ' ' << y - 1 << ' ' << 'H';
  65. cout << endl;
  66. }
  67. }
  68.  
  69. signed main() {
  70. ios_base::sync_with_stdio(false);
  71. cin.tie(nullptr);
  72. ll t = 1;
  73. //cin >> t;
  74. while (t--)
  75. solve();
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement