QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#68480#5101. Crystal Crosswindnocriz#WA 25ms66992kbC++171.7kb2022-12-16 19:52:362022-12-16 19:52:37

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-16 19:52:37]
  • 评测
  • 测评结果:WA
  • 用时:25ms
  • 内存:66992kb
  • [2022-12-16 19:52:36]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
struct node
{
	int x,y;
	node(int nx=0,int ny=0){x=nx;y=ny;}
}q[1000005];
int n,m,k,dx,dy,num,bn[1005][1005],is[1005][1005],nt[1005][1005],vis[1005][1005];
int l,r;
vector<node>s[2][1005][1005];
int ok(int x,int y){return x&&y&&x<=n&&y<=m;}
void bfs(int id)
{
	while(l<r)
	{
		node h=q[l++];
		for(int i=0;i<s[id][h.x][h.y].size();i++)
		{
			node v=s[id][h.x][h.y][i];
			if(bn[v.x][v.y]==0)
			{
				bn[v.x][v.y]=1;
				q[r++]=node(v.x,v.y);
			}
		}
	}
}
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=k;i++)
	{
		memset(vis,0,sizeof(vis));
		scanf("%d%d%d",&dx,&dy,&num);
		for(int j=1;j<=num;j++)
		{
			int x,y;
			scanf("%d%d",&x,&y);
			vis[x][y]=1;
			is[x][y]=1;
			if(ok(x-dx,y-dy))nt[x-dx][y-dy]=1;
		}
		for(int j=1;j<=n;j++)
		{
			for(int k=1;k<=m;k++)
			{
				if(vis[j][k])continue;
				if(ok(j-dx,k-dy))
				{
					s[0][j][k].push_back(node(j-dx,k-dy));
					s[1][j-dx][k-dy].push_back(node(j,k));
				}
				else nt[j][k]=1;
			}
		}
	}
	l=r=1;
	memset(bn,0,sizeof(bn));
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(is[i][j])q[r++]=node(i,j),bn[i][j]=1;
		}
	}
	bfs(0);
	for(int j=1;j<=m;j++)
	{
		for(int i=1;i<=n;i++)
		{
			if(bn[i][j])printf("#");
			else printf(".");
		}
		printf("\n");
	}
	printf("\n");
	l=r=1;
	memset(bn,0,sizeof(bn));
	for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++)
			{
				if(nt[i][j])q[r++]=node(i,j),bn[i][j]=1;
			}
		}
	bfs(1);
	for(int j=1;j<=m;j++)
		{
			for(int i=1;i<=n;i++)
			{
				if(bn[i][j])printf(".");
				else printf("#");
			}
			printf("\n");
		}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 8ms
memory: 66560kb

input:

4 1 1
0 1 2 1 1 3 1

output:

#.#.

#.#.

result:

ok 3 lines

Test #2:

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

input:

4 4 2
1 0 4 2 4 2 1 1 3 1 2
-1 0 4 4 3 4 2 3 1 3 4

output:

.##.
####
####
.##.

.##.
####
####
.##.

result:

ok 9 lines

Test #3:

score: 0
Accepted
time: 16ms
memory: 66740kb

input:

8 12 1
-1 -4 10 5 7 2 4 1 5 5 11 1 6 5 3 8 11 5 1 1 4 7 3

output:

....#...
........
....#.#.
##......
#.......
#.......
....#...
........
........
........
....#..#
........

....#...
........
..#####.
##......
#.......
#.......
...##.#.
........
........
........
....#..#
........

result:

ok 25 lines

Test #4:

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

input:

4 4 2
1 0 6 2 1 1 2 1 3 4 3 2 4 4 2
-1 0 6 4 2 2 2 2 3 3 1 3 4 4 3

output:

.##.
##.#
##.#
.##.

.##.
##.#
##.#
.##.

result:

ok 9 lines

Test #5:

score: 0
Accepted
time: 25ms
memory: 66796kb

input:

8 10 1
-6 -6 25 7 3 8 5 8 6 4 5 4 4 3 2 5 3 6 8 5 4 1 9 1 8 7 10 8 4 2 7 3 9 2 4 3 10 4 6 2 10 3 6 8 8 6 10 4 3 6 1 7 9

output:

.....#..
..#.....
...##.#.
.#.##..#
...#...#
..##...#
.#......
#....#.#
#.#...#.
.##..##.

.....#..
.##.....
#..##.#.
##.##..#
...#...#
..##...#
.#......
#....#.#
#.#...#.
.##..##.

result:

ok 21 lines

Test #6:

score: -100
Wrong Answer
time: 12ms
memory: 66992kb

input:

30 25 2
9 -15 229 27 8 13 20 25 20 15 9 7 16 23 4 2 18 20 21 21 24 19 24 2 23 19 18 25 7 11 6 7 5 4 12 15 25 13 1 28 20 9 1 8 8 17 21 3 1 21 20 14 20 1 12 14 16 9 5 19 17 7 24 11 20 15 18 15 11 28 12 9 15 19 20 30 15 4 17 10 13 4 9 20 24 2 24 13 9 20 25 25 24 11 14 20 19 24 12 9 9 3 5 27 14 19 12 12...

output:

..##...##..##....####.....##..
..........###............#....
.......###.##.#.#.....##..##.#
...###.....#..#.....#.#...#.#.
#.##..#.#.#...#.......#..#.#..
#.........#........##..#..#...
...#....#.#....#.##.....#..#..
.......##...##.#..#.#.#..##.#.
...#....#####.#.....##.###....
.#..##.......#...##.#...

result:

wrong answer 27th lines differ - expected: '..##...##.###....####.....##..', found: '####...##.###....####.....##..'