Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iostream>
- #include <array>
- #include <vector>
- #include <numeric>
- #include <random>
- #include <chrono>
- #include <set>
- #include <map>
- #include <queue>
- using namespace std;
- #define int long long
- const int INF = 1e18 + 7;
- const int MAXN = 1e4 + 1000;
- const int N = 1e5 + 10;
- int make_xor(int n, int m, int k) {
- int ans = 0;
- for (int i = 0; i < n; ++i) {
- ans ^= 2;
- }
- for (int i = 0; i < m; ++i) {
- ans ^= 3;
- }
- ans ^= k;
- return ans;
- }
- signed main() {
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- int n, m;
- cin >> n >> m;
- if (make_xor(n, m, 0) == 0) {
- cout << 2 << '\n';
- } else {
- cout << 1 << '\n';
- vector<pair<int, int>> ans;
- if (n) {
- if (make_xor(n - 1, m, 1) == 0) {
- ans.emplace_back(2, 1);
- }
- if (make_xor(n - 1, m, 0) == 0) {
- ans.emplace_back(2, 2);
- }
- }
- if (m) {
- if (make_xor(n, m - 1, 2) == 0) {
- ans.emplace_back(3, 1);
- }
- if (make_xor(n, m - 1, 1) == 0) {
- ans.emplace_back(3, 2);
- }
- if (make_xor(n, m - 1, 0) == 0) {
- ans.emplace_back(3, 3);
- }
- }
- cout << ans.size() << '\n';
- for (auto [x, y]: ans) {
- cout << x << ' ' << y << '\n';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement