QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#189238#5101. Crystal Crosswindbulijiojiodibuliduo#RE 2ms7808kbC++172.3kb2023-09-27 02:32:192023-09-27 02:32:19

Judging History

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

  • [2023-09-27 02:32:19]
  • 评测
  • 测评结果:RE
  • 用时:2ms
  • 内存:7808kb
  • [2023-09-27 02:32:19]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=1010;
bool bd[11][N][N];
int st[N][N];
int dx,dy,k;
vector<PII> px;
void del(int x,int y);

void add(int x,int y) {
	//printf("add %d %d\n",x,y);
	assert(st[x][y]!=0);
	assert(x>=1&&x<=dx&&y>=1&&y<=dy);
	if (st[x][y]==1) return;
	st[x][y]=1;
	rep(i,0,k) {
		auto [wx,wy]=px[i];
		//printf("aa %d %d %d %d\n",x,y,x-wx,y-wy);
		if (bd[i][x][y]) {
			del(x-wx,y-wy);
		} else {
			add(x-wx,y-wy);
		}
	}
	//puts("---");
}
void del(int x,int y) {
	//printf("del %d %d\n",x,y);
	assert(st[x][y]!=1);
	if (!(x>=1&&x<=dx&&y>=1&&y<=dy)) return;
	if (st[x][y]==0) return;
	st[x][y]=0;
	rep(i,0,k) {
		auto [wx,wy]=px[i];
		int cx=x+wx,cy=y+wy;
		//printf("dd %d %d %d %d\n",x,y,cx,cy);
		if (cx>=1&&cx<=dx&&cy>=1&&cy<=dy&&bd[i][cx][cy]) {
			add(cx,cy);
		} else {
			del(cx,cy);
		}
	}
	//puts("---");
}

int main() {
	scanf("%d%d%d",&dx,&dy,&k);
	rep(i,0,k) {
		int wx,wy;
		scanf("%d%d",&wx,&wy);
		px.pb(mp(wx,wy));
		//printf("dir %d %d\n",wx,wy);
		int b;
		scanf("%d",&b);
		rep(j,0,b) {
			int x,y;
			scanf("%d%d",&x,&y);
			bd[i][x][y]=1;
		}
	}
	rep(i,1,dx+1) rep(j,1,dy+1) st[i][j]=-1;
	rep(v,0,k) rep(i,1,dx+1) rep(j,1,dy+1) if (bd[v][i][j]) add(i,j);
	rep(i,1,dx+1) rep(j,1,dy+1) if (st[i][j]==-1) {
		rep(v,0,k) {
			int cx=i-px[v].fi,cy=j-px[v].se;
			if (!(cx>=1&&cx<=dx&&cy>=1&&cy<=dy)) del(i,j);
		}
	}
	rep(j,1,dy+1) {
		rep(i,1,dx+1) {
			printf("%c","..#"[st[i][j]+1]);
		}
		puts("");
	}
	puts("");
	rep(j,1,dy+1) {
		rep(i,1,dx+1) {
			printf("%c","#.#"[st[i][j]+1]);
		}
		puts("");
	}

}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 5716kb

input:

4 1 1
0 1 2 1 1 3 1

output:

#.#.

#.#.

result:

ok 3 lines

Test #2:

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

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: 0ms
memory: 5700kb

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: 2ms
memory: 5744kb

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: -100
Runtime Error

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: