Advertisement
Guest User

Untitled

a guest
Feb 25th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define llong long long
  3.  
  4. #define cin fin
  5. //#define cout fout
  6.  
  7. using namespace std;
  8.  
  9. ifstream fin("path01.in");
  10. ofstream fout("input.sol");
  11.  
  12. int move_x[4] = {0, 1, 0, -1};
  13. int move_y[4] = {1, 0, -1, 0};
  14.  
  15. int X, Y;
  16.  
  17. int answ = 1;
  18.  
  19. int evaluate(vector<vector<pair<int, int> > >& dirs)
  20. {
  21. int x0, y0;
  22. bool stat = 0;
  23. for (int y = 0; y < Y; y++) {
  24. for (int x = 0; x < X; x++) {
  25. if (dirs[y][x].first == x && dirs[y][x].second == y) {
  26. x0 = x;
  27. y0 = y;
  28. stat = 1;
  29. break;
  30. }
  31. }
  32. if (stat) {
  33. break;
  34. }
  35. }
  36.  
  37. int answ = 1;
  38. }
  39.  
  40. int main()
  41. {
  42. int T;
  43. cin >> T;
  44. for (int t = 0; t < 1; t++) {
  45. cin >> X >> Y;
  46. int OP = 1e7 / X / Y;
  47. vector<vector<pair<int, int> > > dirs(Y, vector<pair<int, int> >(X));
  48.  
  49. vector<vector<int> > field(Y, vector<int>(X));
  50.  
  51. for (int i = 0; i < Y; i++) {
  52. for (int j = 0; j < X; j++) {
  53. cin >> field[i][j];
  54. }
  55. }
  56.  
  57. for (int i = 0; i < Y; i++) {
  58. for (int j = 0; j < X; j++) {
  59. if (i % 2 == 0) {
  60. if (j != X - 1) {
  61. dirs[i][j] = {i, j + 1};
  62. }
  63. else {
  64. dirs[i][j] = {i + 1, j};
  65. if (i == Y - 1) {
  66. dirs[i][j] = {i, j};
  67. }
  68. }
  69. }
  70. else if (i % 2 == 1) {
  71. if (j != 0) {
  72. dirs[i][j] = {i, j - 1};
  73. }
  74. else {
  75. dirs[i][j] = {i + 1, j};
  76. if (i == Y - 1) {
  77. dirs[i][j] = {i, j};
  78. }
  79. }
  80. }
  81. cout << "(" << dirs[i][j].first << " " << dirs[i][j].second << ") ";
  82. }
  83. cout << "\n";
  84. }
  85.  
  86. /*for (int op = 0; op < OP; op++) {
  87. while(1) {
  88. int p1 = {rand() % X, rand() %}
  89. int dir0 = rand() %
  90. }
  91. }*/
  92. }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement