Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <cmath>
- #include <iomanip>
- #include <fstream>
- #include <string>
- #include <set>
- #include <deque>
- #include <queue>
- #include <map>
- #include <bitset>
- #include <random>
- #include <cassert>
- #include <unordered_map>
- #include <unordered_set>
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef long double ld;
- #define sqrt sqrtl
- #define endl "\n"
- #define all(a) a.begin(), a.end()
- #define allr(a) a.rbegin(), a.rend()
- #define pb push_back
- #define F first
- #define S second
- void solve() {
- ll x, y;
- cin >> x >> y;
- if ((x + y) & 1)
- cout << -1 << endl;
- else if (y>>x > 0 && x == y) {
- cout << 0 << endl;
- }
- else if (y > -x) {
- cout << 1 << endl;
- if(y>x)
- cout << (x + y) / 2 << ' ' << (x + y) / 2 << ' ' << 'H' << endl;
- else
- cout << (x + y) / 2 << ' ' << (x + y) / 2 << ' ' << 'V' << endl;
- }
- else if (y < x) {
- cout << 2 << endl;
- cout << 1 << ' ' << 1 << ' ' << 'H';
- cout << endl;
- cout << (x - y) / 2 + 1 << ' ' << 1 - (x - y) / 2 << ' ' << 'V';
- cout<<endl;
- }
- else if (y > x) {
- cout << 2 << endl;
- cout << 1 << ' ' << 1 << ' ' << 'V';
- cout << endl;
- cout << 1 - (y - x) / 2 << ' ' << 1 + (y - x) / 2 << ' ' << 'H';
- cout << endl;
- }
- else {
- cout << 3 << endl;
- cout << 1 << ' ' << 1 << ' ' << 'H';
- cout << endl;
- cout << 2 << ' ' << 0 << ' ' << 'V';
- cout << endl;
- cout << x + 1 << ' ' << y - 1 << ' ' << 'H';
- cout << endl;
- }
- }
- signed main() {
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- ll t = 1;
- //cin >> t;
- while (t--)
- solve();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement