ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#195438 | #3419. 方格判定 | Mango2011 | 100 | 68ms | 2244kb | C++ | 1.2kb | 2023-10-18 19:04:23 | 2023-10-18 22:12:23 |
answer
#include<bits/stdc++.h>
using namespace std;
#define maxn 1005
char a[maxn][maxn];
bool is(int x,int y);
int main()
{
ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
int i,j,n,m,gs=0,al=0,t1,t2;
for(i=0;i<maxn;i++)
{
for(j=0;j<maxn;j++)
{
a[i][j]='#';
}
}
cin>>n>>m;
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
cin>>a[i][j];
if(a[i][j]=='#')
{
al++;
}
}
}
for(i=2;i<=n-3;i++)
{
for(j=2;j<=m-2;j++)
{
if(is(i,j))
{
gs++;
}
}
}
for(i=0;i<=10000;i++)
{
t1=al-146*i;
if(t1<0)
{
break;
}
if(t1%100!=0)
{
continue;
}
t2=t1/100;
if(i*2+t2==gs)
{
cout<<i<<' '<<t2<<endl;
break;
}
}
return 0;
}
bool is(int x,int y)
{
if(!(a[x][y]=='.'&&a[x][y+1]=='.'&&a[x+1][y-1]=='.'&&a[x+1][y]=='.'&&a[x+1][y+1]=='.'&&a[x+1][y+2]=='.'&&a[x+2][y-1]=='.'&&a[x+2][y]=='.'&&a[x+2][y+1]=='.'&&a[x+2][y+2]=='.'))
{
return false;
}
if(a[x-1][y]=='#'&&a[x-1][y+1]=='#'&&a[x][y-1]=='#'&&a[x][y+2]=='#'&&a[x+1][y-2]=='#'&&a[x+1][y+3]=='#'&&a[x+2][y-2]=='#'&&a[x+2][y+3]=='#'&&a[x+3][y-1]=='#'&&a[x+3][y+2]=='#'&&a[x+4][y]=='#'&&a[x+4][y+1]=='#')
{
return true;
}
return false;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 2240kb
input:
17 17 ......##########. ......##########. ......##########. ......####..####. ......###....###. .......
output:
1 0
result:
ok single line: '1 0'
Test #2:
score: 10
Accepted
time: 0ms
memory: 2240kb
input:
17 17 ...........###... ...........###... ...........###... ...........###... ....##########... .......
output:
0 1
result:
ok single line: '0 1'
Test #3:
score: 10
Accepted
time: 2ms
memory: 2240kb
input:
17 17 ................. ................. ................. ................. .##############.. .###...
output:
0 1
result:
ok single line: '0 1'
Test #4:
score: 10
Accepted
time: 1ms
memory: 2240kb
input:
50 50 ##########...................##############....### ##########...................##############...
output:
1 11
result:
ok single line: '1 11'
Test #5:
score: 10
Accepted
time: 0ms
memory: 2240kb
input:
50 50 ......................###......................... ......................###.....................
output:
5 5
result:
ok single line: '5 5'
Test #6:
score: 10
Accepted
time: 0ms
memory: 2240kb
input:
50 50 ......##########.................................. ......##########.......####################...
output:
7 2
result:
ok single line: '7 2'
Test #7:
score: 10
Accepted
time: 14ms
memory: 2244kb
input:
1000 1000 ##########..##########..##########..##########..##########..##########..##########..######...
output:
4316 0
result:
ok single line: '4316 0'
Test #8:
score: 10
Accepted
time: 15ms
memory: 2240kb
input:
1000 1000 .............................................................................................
output:
539 235
result:
ok single line: '539 235'
Test #9:
score: 10
Accepted
time: 19ms
memory: 2244kb
input:
1000 1000 .............................................................................................
output:
3 7
result:
ok single line: '3 7'
Test #10:
score: 10
Accepted
time: 17ms
memory: 2244kb
input:
1000 1000 .............................................................................................
output:
9 1
result:
ok single line: '9 1'
Extra Test:
score: 0
Extra Test Passed