Start: Jun, 05, 2019 17:00:00
2019春ACM通识课考试(第三场)
End: Jun, 05, 2019 20:15:00
Time elapsed:
Time remaining:

Problem_ID: I
Result: Accepted
Time: 234ms
Memory: 1712kB
Author: 2018212212028
In contest: 1272

#include<algorithm>
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define ll long long

int main ()
{
	int t;
	scanf("%d",&t);
	while (t--)
	{
	int n,m;
	scanf("%d %d",&n,&m);
	int t,c,a,b;
	int az[20][20];
	memset(az,0,sizeof(az));
	for (int i = 0; i < m; i++)
	{
		scanf("%d %d %d %d",&t,&c,&a,&b);
		if(a<0)a=0;
		if(b>n)b=n-1;
		if(a>n)continue;
		if(b<0)continue;
		if(t==2)
		{
			for (int j = a; j <=b; j++)
			{
				az[c][j]=1;
			}
		}
		else if(t==1||t==-1||t==0)
		{
			for (int j = a; j <= b; j++)
			{
				for (int z = 0; z <n; z++)
				{
					if(z==t*j+c)
					{
						az[j][z]=1;
					}
				}
			}
		}
	}			

	int Q;
	cin>>Q;
			for (int j = 0; j < n; j++)
		{
			for (int k = 0; k < n; k++)
			{
				if(az[j][k]==1)
				{
					printf("*");
				}
				else
				{
					printf(" ");
				}
			}
			printf("\n");
		}
	while (Q--)
	{
    int q;
	cin>>q;
		for (int j = 0; j < n*q; j++)
		{
			for (int k = 0; k < n*q; k++)
			{
				if(az[(j/q)][(k/q)]==1)
				{
					printf("*");
				}
				else
				{
					printf(" ");
				}
			}
			printf("\n");
		}
	}
	}
}