Home > Back-end >  OJ on time overrun, bosses, please help take a look
OJ on time overrun, bosses, please help take a look

Time:02-11

Fort... the magic fairy has a magic lamp, numbered from (1, 1) - (n, m), define the upper left corner (1, 1), the lower right corner of (n, m) (XD
The state of the magic lamp in 0, 1
0, 1 on behalf of open
The lights he sister now know the initial state
He sister each operation can make (x1, y1) to (x2, y2) all lights in the matrix of state inversion
He sister want to know the status of the q after operating lamps
Enter

The first line of input a number t, on behalf of t group data
Each group of data is the first line of two Numbers n, m, q
The next n lines, each line of input m number on behalf of the original form of street lamp
The next q lines, input the x1, y1, x2, y2
Data range: 1 & lt;=t<=10, 1 & lt;=n, m<=400, 1 & lt;=x1 & lt;=x2 & lt;=n, 1 & lt;=y1 & lt;=y2 & lt;=m, 1 & lt;=q<=1000
O

Each set of output lights last state
The sample input Copy

1
2, 3, 4,
0 0 0 0
0 0 0 0
0 0 0 0
1 1 2 3
2, 2, 3, 4,
Sample output Copy

1110
1001
0111


Here is my code
# include
Int a [405] [405].
Int main ()
{
Int t;
The scanf (" % d ", & amp; t);
While (t -)
{
Int I, j, n, m, q, x1, y1, x2, y2.
The scanf (" % d % d % d ", & amp; N, & amp; M, & amp; Q);
for(i=1; i<=n; I++)
{
for(j=1; J<=m; J++)
{
The scanf (" % d ", & amp; A [I] [j]);
}
}
While (q)
{
The scanf (" % d % d % d % d ", & amp; X1, & amp; Y1, & amp; X2, & amp; Y2);
For (I=x1; i<=x2; I++)
{
For (j=y1; J<=y2; J++)
{
If (a [I] [j]==1)
A [I] [j]=0;
Else if (a [I] [j]==0)
A [I] [j]=1;
}
}
}
for(i=1; i<=n; I++)
{
for(j=1; J<=m; J++)
{
Printf (" % d ", a [I] [j]);
}
printf("\n");
}
}
return 0;
}