Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <cstdio>
- #include <cmath>
- #include <iomanip>
- #include <cstdlib>
- #include <climits>
- #include <algorithm>
- using namespace std;
- void FindSquare(char **squarray, int n)
- {
- vector <vector <pair <int, int>>> area;
- vector <vector <pair <int, int>>> rebra;
- vector <pair <int, int>> usel;
- vector <pair <int, int>> noway;
- pair <int, int> coordinate;
- int ans = 0;
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < n; j++) {
- if (squarray[i][j] == 'x') {
- ans++;
- usel.emplace_back(make_pair(i, j));
- }
- }
- }
- for (int i = 0; i < ans; i++)//в парах координаты всех иксов, начинаем искать смежные
- {
- for (auto c:usel)
- {
- if (c != usel[i])
- {
- int di = abs(usel[i].first - c.first);
- int dj = abs(usel[i].second - c.second);
- if (di <= 1 && dj <= 1)
- {
- rebra.emplace_back(usel[i]);
- }
- else noway.push_back(usel[i]);
- }
- }
- }
- }
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- int t, n;
- cin >> t;
- for (int i = 0; i < t; ++i)
- {
- char a;
- cin >> n;
- char **sqarray = new char* [n];
- for (int g = 0; g < n; ++g)
- {
- sqarray[g] = new char[n];
- for (int j = 0; j < n; j++) {
- cin >> a;
- sqarray[g][j] = a;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement