Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. #define pb push_back
  4. #define F first
  5. #define S second
  6. #define ll long long
  7. #define ld long double
  8. #define null NULL
  9. //#define endl '\n'
  10.  
  11. using namespace std;
  12.  
  13. mt19937 gen(chrono::system_clock::now().time_since_epoch().count());
  14.  
  15. const int M = 1e9 + 7;
  16. const int N = 1e6 + 7;
  17.  
  18. int n, m, k = 2, x, y;
  19. bool f[30][30], fl = 0;
  20.  
  21. int main() {
  22. ios_base::sync_with_stdio(0);
  23. cin.tie(0);
  24. cout.tie(0);
  25. #ifdef LOCAL
  26. // freopen("input.txt", "r", stdin);
  27. // freopen("output.txt", "w", stdout);
  28. #else
  29. // freopen("relatives.in", "r", stdin);
  30. // freopen("relatives.out", "w", stdout);
  31. #endif
  32. cin >> n >> m;
  33. f[1][1] = 1;
  34. f[n][m] = 1;
  35. cout << "2 1" << endl;
  36. while (1){
  37. cin >> x >> y;
  38. f[x][y] = 1;
  39. if (k == 2 && x == 2 && y == 2){
  40. fl = 1;
  41. cout << "1 2" << endl;
  42. cout << "x_X" << endl;
  43. return 0;
  44. }
  45. if (fl){
  46. cout << "x_X" << endl;
  47. return 0;
  48. }
  49. if (!f[1][k - 1]){
  50. cout << "1 " << k - 1 << endl;
  51. f[1][k - 1] = 1;
  52. fl = 1;
  53. cout << "x_X" << endl;
  54. return 0;
  55. }
  56. else if (!f[2][k]){
  57. cout << "2 " << k << endl;
  58. f[2][k] = 1;
  59. if (k == m){
  60. fl = 1;
  61. cout << "x_X" << endl;
  62. return 0;
  63. }
  64. else k++;
  65. }
  66. }
  67. return 0;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement