ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#195726 | #3419. 方格判定 | wsy2011 | 100 | 186ms | 2280kb | C++ | 725b | 2023-10-18 20:52:00 | 2023-10-18 22:34:04 |
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e3+1;
int n,m,cnt1,cnt2;
string s[N];
bool check(int x,int y,char c) {
if(x>=1&&x<=n&&y>=0&&y<m&&s[x][y]==c) return true;
else return false;
}
int main() {
cin>>n>>m;
for(int i=1;i<=n;i++) cin>>s[i];
for(int i=1;i<=n;i++) {
for(int j=0;j<m;j++) {
if(s[i][j]=='.') {
if(check(i-1,j,'.')&&check(i+2,j,'.')&&check(i,j-1,'.')&&check(i,j+2,'.')&& check(i-2,j,'#')&&check(i+3,j,'#')&&check(i,j-2,'#')&&check(i,j+3,'#')&& check(i-1,j-1,'#')&&check(i-1,j+2,'#')&&check(i+2,j-1,'#')&&check(i+2,j+2,'#')) cnt2+=12;
} else if(s[i][j]=='#') cnt1++;
}
}
int x,y;
x=(cnt2*25-cnt1*3)/162;
y=cnt2/12-2*x;
cout<<x<<" "<<y;
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1252kb
input:
17 17 ......##########. ......##########. ......##########. ......####..####. ......###....###. .......
output:
1 0
result:
ok single line: '1 0'
Test #2:
score: 10
Accepted
time: 0ms
memory: 1248kb
input:
17 17 ...........###... ...........###... ...........###... ...........###... ....##########... .......
output:
0 1
result:
ok single line: '0 1'
Test #3:
score: 10
Accepted
time: 0ms
memory: 1248kb
input:
17 17 ................. ................. ................. ................. .##############.. .###...
output:
0 1
result:
ok single line: '0 1'
Test #4:
score: 10
Accepted
time: 0ms
memory: 1252kb
input:
50 50 ##########...................##############....### ##########...................##############...
output:
1 11
result:
ok single line: '1 11'
Test #5:
score: 10
Accepted
time: 1ms
memory: 1256kb
input:
50 50 ......................###......................... ......................###.....................
output:
5 5
result:
ok single line: '5 5'
Test #6:
score: 10
Accepted
time: 0ms
memory: 1252kb
input:
50 50 ......##########.................................. ......##########.......####################...
output:
7 2
result:
ok single line: '7 2'
Test #7:
score: 10
Accepted
time: 36ms
memory: 2280kb
input:
1000 1000 ##########..##########..##########..##########..##########..##########..##########..######...
output:
4316 0
result:
ok single line: '4316 0'
Test #8:
score: 10
Accepted
time: 48ms
memory: 2280kb
input:
1000 1000 .............................................................................................
output:
539 235
result:
ok single line: '539 235'
Test #9:
score: 10
Accepted
time: 52ms
memory: 2280kb
input:
1000 1000 .............................................................................................
output:
3 7
result:
ok single line: '3 7'
Test #10:
score: 10
Accepted
time: 49ms
memory: 2280kb
input:
1000 1000 .............................................................................................
output:
9 1
result:
ok single line: '9 1'
Extra Test:
score: 0
Extra Test Passed