QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#48623#3999. BpbBppbpBBSaturdayForeverAC ✓62ms70832kbC++1.2kb2022-09-14 19:30:222022-09-14 19:30:24

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-14 19:30:24]
  • 评测
  • 测评结果:AC
  • 用时:62ms
  • 内存:70832kb
  • [2022-09-14 19:30:22]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N = 1009;
char mp[N][N];
int vis[N][N],circle;
int siz[20009],poi[20009][2];
int n,m,S,C,tot,sum;


int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

char O[6][6] = {"#..#",
			    "....",
			    "....",
			    "#..#"};
int check(int x,int y){
	for(int i = 0;i < 4;i++){
		for(int j = 0;j < 4;j++){
			if(O[i][j] != mp[x+i][y+j])
				return 0;
		}
	}
	return 1;
}
void dfs(int x,int y){
	vis[x][y] = tot;
	siz[tot]++;
	for(int i = 0;i < 4;i++){
		int tx = x+dx[i],ty = y+dy[i];
		if(tx<1||tx>n||ty<1||ty>m) continue;
		if(vis[tx][ty]||mp[x][y] != mp[tx][ty])continue;
		dfs(tx,ty);
	}
}

int main(){
	cin.tie(NULL)->sync_with_stdio(false);
	cin >> n >> m;
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= m;j++){
			cin >> mp[i][j];
		}
	}
	
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= m;j++){
			if(vis[i][j])continue;
			//printf("(%d,%d)",i,j);
			tot++;
			poi[tot][0] = i;
			poi[tot][1] = j;
			dfs(i,j);
			sum += siz[tot]*(mp[i][j] == '#');
			if(mp[i][j] == '.'&&siz[tot] == 12 && check(poi[tot][0],poi[tot][1]-1))
				circle ++;
		}
	}
	cerr << circle <<","<<sum;
	C = (100*circle - sum)/54;
	S = circle - 2*C;
	cout << C <<" "<< S;
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 4ms
memory: 3612kb

input:

10 17
#################
#################
#################
####..#####..####
###....###....###
###....###....###
####..#####..####
#################
#################
#################

output:

1 0

result:

ok single line: '1 0'

Test #2:

score: 0
Accepted
time: 3ms
memory: 3692kb

input:

14 11
.##########
.##########
.##########
.####..####
.###....###
.###....###
.####..####
.##########
.##########
.##########
.###.......
.###.......
.###.......
.###.......

output:

0 1

result:

ok single line: '0 1'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3748kb

input:

20 14
.##########...
.##########...
.##########...
.####..####...
.###....###...
.###....###...
.####..####...
.##########...
.##########...
.##########...
.#############
.#############
.#############
.#######..####
....###....###
....###....###
....####..####
##############
##############
#########...

output:

0 2

result:

ok single line: '0 2'

Test #4:

score: 0
Accepted
time: 2ms
memory: 3636kb

input:

1 1
.

output:

0 0

result:

ok single line: '0 0'

Test #5:

score: 0
Accepted
time: 4ms
memory: 3972kb

input:

50 50
..................................................
..................................................
..................................................
..................................................
..................................................
..........................................

output:

4 1

result:

ok single line: '4 1'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3928kb

input:

50 50
..................................................
..................................................
..................................................
..................................................
..................................................
..........................................

output:

3 7

result:

ok single line: '3 7'

Test #7:

score: 0
Accepted
time: 50ms
memory: 17852kb

input:

1000 1000
...................###.......................................................##########................##########.###.............................................................##############.............................#################..............................#################........

output:

1621 2804

result:

ok single line: '1621 2804'

Test #8:

score: 0
Accepted
time: 40ms
memory: 15784kb

input:

1000 1000
.....##############.....................................................................................##############.....................................##############...................................##########...................................................................#########...

output:

0 5024

result:

ok single line: '0 5024'

Test #9:

score: 0
Accepted
time: 54ms
memory: 16036kb

input:

1000 1000
.....................................................................................................................................................................................................................................................#################...............................

output:

3629 0

result:

ok single line: '3629 0'

Test #10:

score: 0
Accepted
time: 36ms
memory: 17572kb

input:

1000 1000
........................................##########...............................................................................##########..........................................................................................................................................................

output:

944 3746

result:

ok single line: '944 3746'

Test #11:

score: 0
Accepted
time: 41ms
memory: 13992kb

input:

1000 1000
...................................................................................#################........##############......................................................................................................................................................##############.......

output:

2305 1903

result:

ok single line: '2305 1903'

Test #12:

score: 0
Accepted
time: 51ms
memory: 46800kb

input:

1000 1000
...........................................................................................................................................................##########................................................................................................................................

output:

258 523

result:

ok single line: '258 523'

Test #13:

score: 0
Accepted
time: 43ms
memory: 46188kb

input:

1000 1000
.....................................................................................................................................................................................................................................................................................................

output:

539 235

result:

ok single line: '539 235'

Test #14:

score: 0
Accepted
time: 62ms
memory: 70832kb

input:

1000 1000
.....................................................................................................................................................................................................................................................................................................

output:

0 1

result:

ok single line: '0 1'

Test #15:

score: 0
Accepted
time: 60ms
memory: 70556kb

input:

1000 1000
.....................................................................................................................................................................................................................................................................................................

output:

1 0

result:

ok single line: '1 0'

Test #16:

score: 0
Accepted
time: 4ms
memory: 7336kb

input:

100 1000
###################################################################################################################################################################################################################################################################################################...

output:

500 0

result:

ok single line: '500 0'

Test #17:

score: 0
Accepted
time: 9ms
memory: 8100kb

input:

100 1000
###################################################################################################################################################################################################################################################################################################...

output:

580 0

result:

ok single line: '580 0'

Test #18:

score: 0
Accepted
time: 4ms
memory: 7148kb

input:

100 1000
###################################################################################################################################################################################################################################################################################################...

output:

0 700

result:

ok single line: '0 700'

Test #19:

score: 0
Accepted
time: 9ms
memory: 7276kb

input:

100 1000
###################################################################################################################################################################################################################################################################################################...

output:

0 710

result:

ok single line: '0 710'

Test #20:

score: 0
Accepted
time: 0ms
memory: 7296kb

input:

100 1000
###################################################################################################################################################################################################################################################################################################...

output:

0 700

result:

ok single line: '0 700'

Test #21:

score: 0
Accepted
time: 1ms
memory: 7112kb

input:

100 1000
##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....

output:

0 710

result:

ok single line: '0 710'

Test #22:

score: 0
Accepted
time: 5ms
memory: 7112kb

input:

100 1000
###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......#...

output:

0 700

result:

ok single line: '0 700'

Test #23:

score: 0
Accepted
time: 9ms
memory: 7176kb

input:

100 1000
###################################################################################################################################################################################################################################################################################################...

output:

0 710

result:

ok single line: '0 710'

Test #24:

score: 0
Accepted
time: 2ms
memory: 7140kb

input:

100 1000
.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###....

output:

0 700

result:

ok single line: '0 700'

Test #25:

score: 0
Accepted
time: 9ms
memory: 7200kb

input:

100 1000
....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....#######...

output:

0 710

result:

ok single line: '0 710'

Test #26:

score: 0
Accepted
time: 40ms
memory: 22572kb

input:

1000 1000
##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##########..##...

output:

4316 0

result:

ok single line: '4316 0'

Test #27:

score: 0
Accepted
time: 38ms
memory: 30384kb

input:

1000 1000
##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##############..##...

output:

0 5146

result:

ok single line: '0 5146'

Test #28:

score: 0
Accepted
time: 51ms
memory: 45744kb

input:

1000 1000
##################################################################################################################################################################################################################################################################################################...

output:

5800 0

result:

ok single line: '5800 0'

Test #29:

score: 0
Accepted
time: 42ms
memory: 48508kb

input:

1000 1000
##################################################################################################################################################################################################################################################################################################...

output:

5800 0

result:

ok single line: '5800 0'

Test #30:

score: 0
Accepted
time: 43ms
memory: 38600kb

input:

1000 1000
##################################################################################################################################################################################################################################################################################################...

output:

0 7100

result:

ok single line: '0 7100'

Test #31:

score: 0
Accepted
time: 48ms
memory: 38964kb

input:

1000 1000
##################################################################################################################################################################################################################################################################################################...

output:

0 7100

result:

ok single line: '0 7100'

Test #32:

score: 0
Accepted
time: 46ms
memory: 39232kb

input:

1000 1000
##################################################################################################################################################################################################################################################################################################...

output:

0 7100

result:

ok single line: '0 7100'

Test #33:

score: 0
Accepted
time: 42ms
memory: 38748kb

input:

1000 1000
##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########...

output:

0 7100

result:

ok single line: '0 7100'

Test #34:

score: 0
Accepted
time: 34ms
memory: 38332kb

input:

1000 1000
###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###..........

output:

0 7100

result:

ok single line: '0 7100'

Test #35:

score: 0
Accepted
time: 40ms
memory: 38968kb

input:

1000 1000
##################################################################################################################################################################################################################################################################################################...

output:

0 7100

result:

ok single line: '0 7100'

Test #36:

score: 0
Accepted
time: 36ms
memory: 39360kb

input:

1000 1000
.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###.......###...

output:

0 7100

result:

ok single line: '0 7100'

Test #37:

score: 0
Accepted
time: 48ms
memory: 38780kb

input:

1000 1000
....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....##########....######...

output:

0 7100

result:

ok single line: '0 7100'