Arkady is playing Battleship. The rules of this game aren't really important.There is a field of n×n

cells. There should be exactly one k-decker on the field, i. e. a ship that is kcells long oriented either horizontally or vertically. However,

Arkady doesn't know where it is located. For each cell Arkady knows if it is definitely empty or can contain a part of the ship.

Consider all possible locations of the ship. Find such a cell that belongs to the maximum possible number of different locations of the ship.

Input

The first line contains two integers n and k (1≤k≤n≤100) — the size of the field and the size of the ship.

The next n lines contain the filed.Each line cotains ncharacters, each of which is either '#' (denotes a definitely empty cell) or '.' (denotes a cell that can belong to the ship).

Output

Output two integers — the row and the column of a cell that belongs to the maximum possible number of different locations of the ship.

If there are multiple answers, output any of them. In particular, if no ship can be placed on the field, you can output any cell.

Examples
Input
4 3
#..#
#.#.
....
.###
Output
3 2
Input
10 4
#....##...
.#...#....
..#..#..#.
...#.#....
.#..##.#..
.....#...#
...#.##...
.#...#.#..
.....#..#.
...#.#...#
Output
6 1
Input
19 6
##..............###
#......#####.....##
.....#########.....
....###########....
...#############...
..###############..
.#################.
.#################.
.#################.
.#################.
#####....##....####
####............###
####............###
#####...####...####
.#####..####..#####
...###........###..
....###########....
.........##........
#.................#
Output
1 8
Note

The picture below shows the three possible locations of the ship that contain the cell (3,2)

in the first sample.

读了好几遍终于看懂了题目意思,"#"代表空单元,"."代表船部件,并且水平或者竖直的连起来的k个可能构成一个完整的部件,问有没有一个单元可以和其他单元组合构成尽可能多的部件,暴力一下。

#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#pragma comment(linker, "/stck:1024000000,1024000000")
#define lowbit(x) (x&(-x))
#define max(x,y) (x>=y?x:y)
#define min(x,y) (x<=y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.1415926535897932384626433832
#define ios() ios::sync_with_stdio(true)
#define INF 0x3f3f3f3f
#define mem(a) ((a,0,sizeof(a)))
typedef long long ll;
char a[][];
int vis[][];
int n,k;
int main()
{
scanf("%d%d",&n,&k);
for(int i=;i<n;i++)
scanf("%s",&a[i]);
int col=,row=,cnt=,tot=;
memset(vis,,sizeof(vis));
for(int i=;i<n;i++)
{
for(int j=;j<n;j++)
{
if(a[i][j]=='.')
{
cnt=;
for(int z=j;z<min(n,j+k);z++)
if(a[i][z]=='.') cnt++;
if(cnt==k){
for(int z=j;z<min(n,j+k);z++)
vis[i][z]++;
}
cnt=;
for(int z=i;z<min(n,i+k);z++)
if(a[z][j]=='.') cnt++;
if(cnt==k){
for(int z=i;z<min(n,i+k);z++)
vis[z][j]++;
}
}
if(vis[i][j]>tot)
{
tot=vis[i][j];
row=i;
col=j;
}
}
}
printf("%d %d\n",row+,col+);
return ;
}

最新文章

  1. C和指针 第十一章 习题
  2. exec、source以及bash的区别(zz)
  3. Linux内核分析之扒开系统调用的三层皮(下)
  4. rabbitmq心跳机制与配置
  5. Leetcode 235 Lowest Common Ancestor of a Binary Search Tree 二叉树
  6. css省略号布局实例截图
  7. MongoDB学习 (六):查询
  8. hisi平台mii网络模式和rmii网络模式的uboot制作
  9. HDU-1114(背包DP)
  10. poj 2481 Cows(数状数组 或 线段树)
  11. 如何使盘ISO图像文件
  12. Linux OS共享文件
  13. 使用mysql5.7新特性(虚拟列)解决使用前通配符性能问题
  14. 【jQuery】 JQ和HTML以及JQ遍历元素
  15. c/c++ 继承与多态 容器与继承2
  16. uboot中往s5p6818的emmc刷写内容
  17. .Net进阶系列(11)-异步多线程(委托BeginInvoke)(被替换)
  18. 使用redis镜像
  19. TOMCAT8源码分析——处理请求分析(下)
  20. ftp服务通信操作

热门文章

  1. js中cookie的使用 以及缺点
  2. c#邮件发送服务
  3. Springboot如何利用http请求控制器
  4. Jquery 设置class 和 div CSS
  5. swift语言点评十八-异常与错误
  6. Day92
  7. 关于Jwt的一些思考
  8. [luogu] P1772 [ZJOI2006]物流运输(动态规划,最短路)
  9. Linux学习总结(10)——Linux查看CPU和内存使用情况
  10. asp.net 缓存公共类