No tags yet

No tag edit access

The problem statement has recently been changed. View the changes.

×
time limit per test: 0.5 sec.

memory limit per test: 65536 KB

memory limit per test: 65536 KB

input: standard

output: standard

output: standard

It is necessary to arrange numbers from 0 to 2^(N+M)-1 in the matrix with 2^N rows and 2^M columns. Moreover, numbers occupying two adjacent cells must differ only in single bit in binary notation. Cells are adjacent if they have common side. Matrix is cyclic, i.e. for each row the leftmost and rightmost matrix cells are considered to be adjacent (the topmost and the bottommost matrix cells are also adjacent).

The first line of input contains two integers N and M (0<N,M; N+M<=20).

Output file must contain the required matrix in a form of 2^N lines of 2^M integers each.

Input

1 1

Output

0 2

1 3

1 3

Author: | Antony Popovich |

Resource: | Petrozavodsk Summer Training Sessions 2004 |

Date: | August 25, 2004 |

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/18/2021 00:02:29 (j2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|