| Contests - ACM Student Chapter - PSUT |
|---|
| Private |
| Spectator |
| PSUT Marathon 2024 |
|---|
| Finished |
Reef and Abdel Fattah El-Sisi are playing a game. They are given a grid $$$a$$$ of size $$$n$$$ x $$$m$$$. In this game, Reef can only win if every pair of adjacent cells has the same product, otherwise El-Sisi wins. A cell is said to be adjacent to another cell if they share a side. You have to process $$$q$$$ queries on this grid of the following format:
We're interested in knowing if Reef can win after each query, output $$$\small\textbf{REEF}$$$ if Reef can win after the query and $$$\small\textbf{EL-SISI}$$$ otherwise.
Don't worry, in this game El-Sisi can actually lose sometimes!
And yes, Aboud and Fakher are still playing 2v2v2v2.
The first line contains an integer $$$n$$$ $$$(1≤n≤500, 1≤m≤500, 1≤q≤10^5)$$$ — the number of rows, columns and queries respectively
The following $$$n$$$ lines contain $$$m$$$ integers each, the $$$j$$$-th element in the $$$i$$$-th line is $$$a_{ij}$$$ $$$(0≤a_{ij}≤10^9)$$$
Then follows $$$q$$$ queries $$$i$$$ $$$j$$$ $$$x$$$ $$$(1≤i≤n, 1≤j≤m, 0≤x≤10^9)$$$
After each query output $$$\small\textbf{REEF}$$$ if Reef can win and $$$\small\textbf{EL-SISI}$$$ otherwise
1 1 1 1 1 1 0
REEF
2 2 2 1 2 3 4 1 2 3 2 2 1
EL-SISI REEF
2 4 5 0 0 0 0 1 2 3 4 2 1 0 2 3 0 1 1 4 1 2 5 1 1 0
EL-SISI REEF REEF EL-SISI EL-SISI
| Name |
|---|

