Submission #41042647


Source Code Expand

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr ll INFLL = numeric_limits<ll>::max() / 2;

template<class T>
istream &operator>>(istream &is, vector<T> &a) {
    for (auto &i : a) {
        is >> i;
    }
    return is;
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
#ifdef __APPLE__
    freopen("input.txt", "r", stdin);
#endif
    int n, m;
    cin >> n >> m;
    vector<string> v(n);
    cin >> v;
    vector<int> ans(min(n, m));
    for (int i = 1; i + 1 < n; ++i) {
        for (int j = 1; j + 1 < m; ++j) {
            if (v[i][j] == '#' && v[i - 1][j - 1] == '#' && v[i - 1][j + 1] == '#' && v[i + 1][j - 1] == '#' && v[i + 1][j + 1] == '#') {
                int cnt = 0;
                while (i - cnt >= 0 && j - cnt >= 0 && v[i - cnt][j - cnt] == '#') {
                    ++cnt;
                }
                ++ans[cnt - 2];
            }
        }
    }
    for (int i : ans) {
        cout << i << " ";
    }
}

Submission Info

Submission Time
Task C - Cross
User FedShat
Language C++ (GCC 9.2.1)
Score 300
Code Size 1058 Byte
Status AC
Exec Time 15 ms
Memory 3576 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 21
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 02_corner_00.txt, 02_corner_01.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 15 ms 3496 KiB
00_sample_01.txt AC 2 ms 3484 KiB
00_sample_02.txt AC 2 ms 3388 KiB
00_sample_03.txt AC 2 ms 3468 KiB
01_random_00.txt AC 2 ms 3500 KiB
01_random_01.txt AC 4 ms 3572 KiB
01_random_02.txt AC 2 ms 3528 KiB
01_random_03.txt AC 2 ms 3524 KiB
01_random_04.txt AC 2 ms 3564 KiB
01_random_05.txt AC 2 ms 3456 KiB
01_random_06.txt AC 4 ms 3484 KiB
01_random_07.txt AC 2 ms 3560 KiB
01_random_08.txt AC 2 ms 3476 KiB
01_random_09.txt AC 2 ms 3472 KiB
01_random_10.txt AC 2 ms 3460 KiB
01_random_11.txt AC 2 ms 3492 KiB
01_random_12.txt AC 2 ms 3492 KiB
01_random_13.txt AC 3 ms 3472 KiB
01_random_14.txt AC 2 ms 3576 KiB
02_corner_00.txt AC 2 ms 3576 KiB
02_corner_01.txt AC 2 ms 3408 KiB