Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define pb push_back
- #define F first
- #define S second
- #define ll long long
- #define ld long double
- #define null NULL
- //#define endl '\n'
- using namespace std;
- mt19937 gen(chrono::system_clock::now().time_since_epoch().count());
- const int M = 1e9 + 7;
- const int N = 1e6 + 7;
- int n, m, k = 2, x, y;
- bool f[30][30], fl = 0;
- int main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- #ifdef LOCAL
- // freopen("input.txt", "r", stdin);
- // freopen("output.txt", "w", stdout);
- #else
- // freopen("relatives.in", "r", stdin);
- // freopen("relatives.out", "w", stdout);
- #endif
- cin >> n >> m;
- f[1][1] = 1;
- f[n][m] = 1;
- cout << "2 1" << endl;
- while (1){
- cin >> x >> y;
- f[x][y] = 1;
- if (k == 2 && x == 2 && y == 2){
- fl = 1;
- cout << "1 2" << endl;
- cout << "x_X" << endl;
- return 0;
- }
- if (fl){
- cout << "x_X" << endl;
- return 0;
- }
- if (!f[1][k - 1]){
- cout << "1 " << k - 1 << endl;
- f[1][k - 1] = 1;
- fl = 1;
- cout << "x_X" << endl;
- return 0;
- }
- else if (!f[2][k]){
- cout << "2 " << k << endl;
- f[2][k] = 1;
- if (k == m){
- fl = 1;
- cout << "x_X" << endl;
- return 0;
- }
- else k++;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement