Advertisement
Guest User

Untitled

a guest
Oct 18th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <cstdio>
  4. #include <cmath>
  5. #include <iomanip>
  6. #include <cstdlib>
  7. #include <climits>
  8. #include <algorithm>
  9.  
  10. using namespace std;
  11.  
  12. void FindSquare(char **squarray, int n)
  13. {
  14. vector <vector <pair <int, int>>> area;
  15. vector <vector <pair <int, int>>> rebra;
  16. vector <pair <int, int>> usel;
  17. vector <pair <int, int>> noway;
  18. pair <int, int> coordinate;
  19. int ans = 0;
  20. for (int i = 0; i < n; i++)
  21. {
  22. for (int j = 0; j < n; j++) {
  23. if (squarray[i][j] == 'x') {
  24. ans++;
  25. usel.emplace_back(make_pair(i, j));
  26. }
  27. }
  28. }
  29. for (int i = 0; i < ans; i++)//в парах координаты всех иксов, начинаем искать смежные
  30. {
  31. for (auto c:usel)
  32. {
  33. if (c != usel[i])
  34. {
  35. int di = abs(usel[i].first - c.first);
  36. int dj = abs(usel[i].second - c.second);
  37. if (di <= 1 && dj <= 1)
  38. {
  39. rebra.emplace_back(usel[i]);
  40. }
  41. else noway.push_back(usel[i]);
  42. }
  43. }
  44. }
  45. }
  46. int main() {
  47. ios_base::sync_with_stdio(false);
  48. cin.tie(nullptr);
  49. cout.tie(nullptr);
  50. int t, n;
  51. cin >> t;
  52. for (int i = 0; i < t; ++i)
  53. {
  54. char a;
  55. cin >> n;
  56. char **sqarray = new char* [n];
  57. for (int g = 0; g < n; ++g)
  58. {
  59. sqarray[g] = new char[n];
  60. for (int j = 0; j < n; j++) {
  61. cin >> a;
  62. sqarray[g][j] = a;
  63. }
  64. }
  65. }
  66. return 0;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement