ソースコード
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;
int32_t N,H,W;
char map1[20][20];
char map2[20][20];
char buf[20];
int main()
{
using std::endl;
in.sync_with_stdio(false);
out.sync_with_stdio(false);
in.tie(nullptr);
out.tie(nullptr);
in >> N >> H >> W;
for (int32_t i = 1; i <= H; i++)
{
in >> (buf+1);
for (int32_t j = 1; j <= W; j++)
{
map1[i][j] = map2[j][i] = buf[j];
}
}
for (int32_t i = 0; i <= H; i++)
{
map1[i][0] = map1[i][W+1] = '#';
map2[0][i] = map2[W + 1][i] = '#';
}
for (int32_t i = 0; i <= W; i++)
{
map1[0][i] = map1[H + 1][i] = '#';
map2[i][0] = map2[i][H + 1] = '#';
}
for (int32_t LEN = 1; LEN <= N; LEN++)
{
int32_t res = 0;
int32_t res_tmp = 0;
for (int32_t i = 1; i <= H; i++)
{
int32_t now_count = 0;
for (int32_t j = 1; j <= W; j++)
{
if (map1[i][j]=='#') {
now_count = 0;
}
else {
++now_count;
if (now_count >= LEN) {
now_count = 0;
++res_tmp;
}
}
}
}
res = std::max(res, res_tmp);
res_tmp = 0;
for (int32_t i = 1; i <= W; i++)
{
int32_t now_count = 0;
for (int32_t j = 1; j <= H; j++)
{
if (map2[i][j] == '#') {
now_count = 0;
}
else {
++now_count;
if (now_count >= LEN) {
now_count = 0;
++res_tmp;
}
}
}
}
res = std::max(res, res_tmp);
out << res << endl;
}
return 0;
}
#endif