QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#32265 | #3999. BpbBppbpBB | DaBenZhongXiaSongKuaiDi# | AC ✓ | 60ms | 59344kb | C++14 | 1.2kb | 2022-05-18 15:44:51 | 2022-05-18 15:44:53 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
int vis[1005][1005];
char a[1005][1005];
int n,m;
int fx[4]={0,0,1,-1},fy[4]={1,-1,0,0};
int CNT=0,mxx,mxy,mnx,mny;
inline void dfs(int x,int y)
{
mnx=min(mnx,x);
mny=min(mny,y);
mxx=max(mxx,x);
mxy=max(mxy,y);
++CNT;
vis[x][y]=1;
for(int i=0;i<4;i++)
{
int nx=x+fx[i],ny=y+fy[i];
if(nx>=0&&nx<=n+1&&ny>=0&&ny<=m+1&&a[nx][ny]=='.'&&!vis[nx][ny]) dfs(nx,ny);
}
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> m;
for(int i=0;i<=n+1;i++)
for(int j=0;j<=m+1;j++)
a[i][j]='.';
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
cin >> a[i][j];
}
dfs(0,0);
int cnt1=0,cnt2=0;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
if(a[i][j]=='.'&&!vis[i][j])
{
CNT=0,mxx=mxy=0,mnx=mny=10000;
dfs(i,j);
if(CNT==12&&mxx-mnx==3&&mxy-mny==3) cnt1+=12;
}
}
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
// cnt1+=(a[i][j]=='.'&&!vis[i][j]);
cnt2+=a[i][j]=='#';
}
}
for(int i=0;i<=1000000;i++)
{
int x=i,y=(cnt1-24*x)/12;
if(x<0||y<0) continue;
int A=i*146,B=y*100;
if(A+B==cnt2)
{
cout << x << " " << y;
return 0;
}
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3636kb
input:
10 17 ################# ################# ################# ####..#####..#### ###....###....### ###....###....### ####..#####..#### ################# ################# #################
output:
1 0
result:
ok single line: '1 0'
Test #2:
score: 0
Accepted
time: 3ms
memory: 5596kb
input:
14 11 .########## .########## .########## .####..#### .###....### .###....### .####..#### .########## .########## .########## .###....... .###....... .###....... .###.......
output:
0 1
result:
ok single line: '0 1'
Test #3:
score: 0
Accepted
time: 3ms
memory: 3848kb
input:
20 14 .##########... .##########... .##########... .####..####... .###....###... .###....###... .####..####... .##########... .##########... .##########... .############# .############# .############# .#######..#### ....###....### ....###....### ....####..#### ############## ############## #########...
output:
0 2
result:
ok single line: '0 2'
Test #4:
score: 0
Accepted
time: 3ms
memory: 5728kb
input:
1 1 .
output:
0 0
result:
ok single line: '0 0'
Test #5:
score: 0
Accepted
time: 2ms
memory: 5776kb
input:
50 50 .................................................. .................................................. .................................................. .................................................. .................................................. ..........................................
output:
4 1
result:
ok single line: '4 1'
Test #6:
score: 0
Accepted
time: 3ms
memory: 5824kb
input:
50 50 .................................................. .................................................. .................................................. .................................................. .................................................. ..........................................
output:
3 7
result:
ok single line: '3 7'
Test #7:
score: 0
Accepted
time: 25ms
memory: 19536kb
input:
1000 1000 ...................###.......................................................##########................##########.###.............................................................##############.............................#################..............................#################........
output:
1621 2804
result:
ok single line: '1621 2804'
Test #8:
score: 0
Accepted
time: 24ms
memory: 19880kb
input:
1000 1000 .....##############.....................................................................................##############.....................................##############...................................##########...................................................................#########...
output:
0 5024
result:
ok single line: '0 5024'
Test #9:
score: 0
Accepted
time: 18ms
memory: 19692kb
input:
1000 1000 .....................................................................................................................................................................................................................................................#################...............................
output:
3629 0
result:
ok single line: '3629 0'
Test #10:
score: 0
Accepted
time: 24ms
memory: 19624kb
input:
1000 1000 ........................................##########...............................................................................##########..........................................................................................................................................................
output:
944 3746
result:
ok single line: '944 3746'
Test #11:
score: 0
Accepted
time: 23ms
memory: 19444kb
input:
1000 1000 ...................................................................................#################........##############......................................................................................................................................................##############.......
output:
2305 1903
result:
ok single line: '2305 1903'
Test #12:
score: 0
Accepted
time: 60ms
memory: 33996kb
input:
1000 1000 ...........................................................................................................................................................##########................................................................................................................................
output:
258 523
result:
ok single line: '258 523'
Test #13:
score: 0
Accepted
time: 24ms
memory: 23028kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
539 235
result:
ok single line: '539 235'
Test #14:
score: 0
Accepted
time: 42ms
memory: 59072kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
0 1
result:
ok single line: '0 1'
Test #15:
score: 0
Accepted
time: 54ms
memory: 59344kb
input:
1000 1000 .....................................................................................................................................................................................................................................................................................................
output:
1 0
result:
ok single line: '1 0'
Test #16:
score: 0
Accepted
time: 0ms
memory: 6552kb
input:
100 1000 ###################################################################################################################################################################################################################################################################################################...
output:
500 0
result:
ok single line: '500 0'
Test #17:
score: 0
Accepted
time: 5ms
memory: 5964kb
input:
100 1000 ###################################################################################################################################################################################################################################################################################################...
output:
580 0
result:
ok single line: '580 0'
Test #18:
score: 0
Accepted
time: 2ms
memory: 6012kb
input:
100 1000 ###################################################################################################################################################################################################################################################################################################...
output:
0 700
result:
ok single line: '0 700'
Test #19:
score: 0
Accepted
time: 5ms
memory: 5884kb
input:
100 1000 ###################################################################################################################################################################################################################################################################################################...
output:
0 710
result:
ok single line: '0 710'
Test #20:
score: 0
Accepted
time: 0ms
memory: 6004kb
input:
100 1000 ###################################################################################################################################################################################################################################################################################################...
output:
0 700
result:
ok single line: '0 700'
Test #21:
score: 0
Accepted
time: 2ms
memory: 6020kb
input:
100 1000 ##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....
output:
0 710
result:
ok single line: '0 710'
Test #22:
score: 0
Accepted
time: 2ms
memory: 5936kb
input:
100 1000 ###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......#...
output:
0 700
result:
ok single line: '0 700'
Test #23:
score: 0
Accepted
time: 2ms
memory: 5956kb
input:
100 1000 ###################################################################################################################################################################################################################################################################################################...
output:
0 710
result:
ok single line: '0 710'
Test #24:
score: 0
Accepted
time: 4ms
memory: 5944kb
input:
100 1000 .......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###....
output:
0 700
result:
ok single line: '0 700'
Test #25:
score: 0
Accepted
time: 5ms
memory: 6236kb
input:
100 1000 ....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....#######...
output:
0 710
result:
ok single line: '0 710'
Test #26:
score: 0
Accepted
time: 14ms
memory: 17976kb
input:
1000 1000 ##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##...
output:
4316 0
result:
ok single line: '4316 0'
Test #27:
score: 0
Accepted
time: 27ms
memory: 20940kb
input:
1000 1000 ##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##...
output:
0 5146
result:
ok single line: '0 5146'
Test #28:
score: 0
Accepted
time: 5ms
memory: 12792kb
input:
1000 1000 ##################################################################################################################################################################################################################################################################################################...
output:
5800 0
result:
ok single line: '5800 0'
Test #29:
score: 0
Accepted
time: 15ms
memory: 12772kb
input:
1000 1000 ##################################################################################################################################################################################################################################################################################################...
output:
5800 0
result:
ok single line: '5800 0'
Test #30:
score: 0
Accepted
time: 15ms
memory: 12600kb
input:
1000 1000 ##################################################################################################################################################################################################################################################################################################...
output:
0 7100
result:
ok single line: '0 7100'
Test #31:
score: 0
Accepted
time: 13ms
memory: 12756kb
input:
1000 1000 ##################################################################################################################################################################################################################################################################################################...
output:
0 7100
result:
ok single line: '0 7100'
Test #32:
score: 0
Accepted
time: 11ms
memory: 12592kb
input:
1000 1000 ##################################################################################################################################################################################################################################################################################################...
output:
0 7100
result:
ok single line: '0 7100'
Test #33:
score: 0
Accepted
time: 15ms
memory: 12564kb
input:
1000 1000 ##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########...
output:
0 7100
result:
ok single line: '0 7100'
Test #34:
score: 0
Accepted
time: 17ms
memory: 12908kb
input:
1000 1000 ###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###..........
output:
0 7100
result:
ok single line: '0 7100'
Test #35:
score: 0
Accepted
time: 11ms
memory: 12944kb
input:
1000 1000 ##################################################################################################################################################################################################################################################################################################...
output:
0 7100
result:
ok single line: '0 7100'
Test #36:
score: 0
Accepted
time: 18ms
memory: 12456kb
input:
1000 1000 .......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###...
output:
0 7100
result:
ok single line: '0 7100'
Test #37:
score: 0
Accepted
time: 16ms
memory: 12912kb
input:
1000 1000 ....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....######...
output:
0 7100
result:
ok single line: '0 7100'